-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Settings module + Browsable API toggle
- Loading branch information
1 parent
0e262c5
commit c3fe7ab
Showing
7 changed files
with
34 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from importlib import import_module | ||
|
||
from django.utils.functional import SimpleLazyObject | ||
|
||
|
||
settings = SimpleLazyObject(lambda: import_module("worf.settings")) |
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,9 @@ | ||
from django.conf import settings | ||
|
||
|
||
WORF_API_NAME = getattr(settings, "WORF_API_NAME", "Worf API") | ||
WORF_API_ROOT = getattr(settings, "WORF_API_ROOT", "/api/") | ||
|
||
WORF_BROWSABLE_API = getattr(settings, "WORF_BROWSABLE_API", True) | ||
|
||
WORF_DEBUG = getattr(settings, "WORF_DEBUG", settings.DEBUG) |
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
<meta name="robots" content="none,noarchive"/> | ||
{% endblock %} | ||
|
||
<title>{{ api_name }}: {{ request.get_full_path }}</title> | ||
<title>{{ settings.WORF_API_NAME }}: {{ request.get_full_path }}</title> | ||
|
||
{% block style %} | ||
<link href="https://unpkg.com/[email protected]/dist/tailwind.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" rel="stylesheet"> | ||
|
@@ -35,8 +35,8 @@ | |
<nav class="p-4"> | ||
<div class="max-w-5xl mx-auto"> | ||
{% block branding %} | ||
<a href="{{ api_root }}" class="font-medium text-lg text-white" rel="nofollow"> | ||
{{ api_name }} | ||
<a href="{{ settings.WORF_API_ROOT }}" class="font-medium text-lg text-white" rel="nofollow"> | ||
{{ settings.WORF_API_NAME }} | ||
</a> | ||
{% endblock %} | ||
</div> | ||
|
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
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