-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add view to display well kwon config
- Loading branch information
1 parent
eff1eb9
commit d63de53
Showing
3 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from django.urls import include, path | ||
|
||
|
||
from .views import serve_text_file | ||
|
||
|
||
urlpatterns = [ | ||
path("pdi-pgp.asc", serve_text_file, {"file_name": "pdi-pgp.asc"}, name="pdi-pgp"), | ||
path("security-policy.txt", serve_text_file, {"file_name": "security-policy.txt"}, name="security-policy"), | ||
path("security.txt", serve_text_file, {"file_name": "security.txt"}, name="security"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import os | ||
from django.http import HttpResponse | ||
|
||
|
||
def serve_text_file(request, file_name): | ||
file_path = os.path.join('static', '.well-known', file_name) | ||
try: | ||
with open(file_path, 'r') as file: | ||
content = file.read() | ||
return HttpResponse(content, content_type='text/plain') | ||
except FileNotFoundError: | ||
return HttpResponse("File not found.", status=404) |