Skip to content

Commit a34a9f8

Browse files
committed
Added URL routes for API docs generation
1 parent 332af9f commit a34a9f8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

server/balancer_backend/urls.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
# Import TemplateView for rendering templates
77
from django.views.generic import TemplateView
88
import importlib # Import the importlib module for dynamic module importing
9+
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView, SpectacularRedocView
10+
11+
912

1013
# Define a list of URL patterns for the application
1114
# Keep admin outside /api/ prefix
@@ -50,6 +53,9 @@
5053
# Wrap all API routes under /api/ prefix
5154
urlpatterns += [
5255
path("api/", include(api_urlpatterns)),
56+
path("api/schema/", SpectacularAPIView.as_view(), name="schema"),
57+
path("api/docs/", SpectacularSwaggerView.as_view(url_name="schema"), name="swagger-ui"),
58+
path("api/redoc/", SpectacularRedocView.as_view(url_name="schema"), name="redoc"),
5359
]
5460

5561
import os

0 commit comments

Comments
 (0)