-
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.
- Loading branch information
1 parent
9c0ecaa
commit c5d775a
Showing
3 changed files
with
8 additions
and
7 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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
from django.urls import include, path | ||
|
||
|
||
from .views import serve_text_file | ||
|
||
|
||
|
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 |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import os | ||
|
||
from django.http import HttpResponse | ||
|
||
|
||
def serve_text_file(request, file_name): | ||
file_path = os.path.join('static', '.well-known', file_name) | ||
file_path = os.path.join("static", ".well-known", file_name) | ||
try: | ||
with open(file_path, 'rb') as file: | ||
with open(file_path, "rb") as file: | ||
content = file.read() | ||
return HttpResponse(content, content_type='text/plain; charset=utf-8') | ||
return HttpResponse(content, content_type="text/plain; charset=utf-8") | ||
except FileNotFoundError: | ||
return HttpResponse(b"File not found.", status=404) |