Skip to content

Commit

Permalink
Merge pull request #44 from City-of-Turku/feature/swagger-ui-only-in-…
Browse files Browse the repository at this point in the history
…debug-mode

feature/swagger UI only in debug mode
  • Loading branch information
juuso-j authored Apr 5, 2024
2 parents d538307 + 6c59aed commit 6d0b397
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions mpbackend/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# from django.conf import settings
from django.conf import settings
from django.contrib import admin
from django.urls import include, path, re_path
from drf_spectacular.views import (
Expand All @@ -17,17 +17,17 @@
# path("api-auth/", include("rest_framework.urls")),
]

# NOTE, consider disabling in production. if settings.DEBUG:
urlpatterns += [
path("api/v1/schema/", SpectacularAPIView.as_view(), name="schema"),
path(
"api/v1/schema/swagger-ui/",
SpectacularSwaggerView.as_view(url_name="schema"),
name="swagger-ui",
),
path(
"api/v1/schema/redoc/",
SpectacularRedocView.as_view(url_name="schema"),
name="redoc",
),
]
if settings.DEBUG:
urlpatterns += [
path("api/v1/schema/", SpectacularAPIView.as_view(), name="schema"),
path(
"api/v1/schema/swagger-ui/",
SpectacularSwaggerView.as_view(url_name="schema"),
name="swagger-ui",
),
path(
"api/v1/schema/redoc/",
SpectacularRedocView.as_view(url_name="schema"),
name="redoc",
),
]

0 comments on commit 6d0b397

Please sign in to comment.