Skip to content

Commit aa27e75

Browse files
feat: Update Swagger UI settings for production and staging environments (#103)
1 parent a2e39a1 commit aa27e75

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

todo_project/settings/production.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@
44
DEBUG = False
55

66
ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS").split(",")
7+
8+
SPECTACULAR_SETTINGS.update({
9+
"SWAGGER_UI_SETTINGS": {
10+
"url": "/todo/api/schema",
11+
},
12+
})

todo_project/settings/staging.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,9 @@
7171
SESSION_COOKIE_DOMAIN = ".realdevsquad.com"
7272
SESSION_COOKIE_SAMESITE = "None"
7373
CSRF_COOKIE_SECURE = True
74+
75+
SPECTACULAR_SETTINGS.update({
76+
"SWAGGER_UI_SETTINGS": {
77+
"url": "/staging-todo/api/schema",
78+
},
79+
})

todo_project/urls.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
from django.urls import path, include
22
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView, SpectacularRedocView
33

4-
urlpatterns = [
5-
# Swagger UI at base path
6-
path("", SpectacularSwaggerView.as_view(url_name="schema"), name="swagger-ui-base"),
4+
urlpatterns = [
75
path("v1/", include("todo.urls"), name="api"),
86
# Swagger/OpenAPI endpoints
9-
path("api/schema/", SpectacularAPIView.as_view(), name="schema"),
10-
path("api/docs/", SpectacularSwaggerView.as_view(url_name="schema"), name="swagger-ui"),
11-
path("api/redoc/", SpectacularRedocView.as_view(url_name="schema"), name="redoc"),
7+
path("api/schema", SpectacularAPIView.as_view(), name="schema"),
8+
path("api/docs", SpectacularSwaggerView.as_view(url_name="schema"), name="swagger-ui"),
9+
path("api/redoc", SpectacularRedocView.as_view(url_name="schema"), name="redoc"),
1210
]

0 commit comments

Comments
 (0)