backend/config/urls.py

41 lines
1.2 KiB
Python
Raw Normal View History

2022-10-25 23:29:13 +03:00
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path
2022-10-26 23:22:04 +03:00
from drf_spectacular.views import (
SpectacularAPIView,
SpectacularRedocView,
SpectacularSwaggerView,
)
2022-10-25 23:29:13 +03:00
urlpatterns = [
2022-10-26 23:22:04 +03:00
path(settings.ADMIN_URL, admin.site.urls)
2022-10-25 23:29:13 +03:00
# Your stuff: custom urls includes go here
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# API URLS
urlpatterns += [
# API base url
path("api/", include("config.api_router")),
2022-10-26 23:22:04 +03:00
path("api_schema/", SpectacularAPIView.as_view(), name="api-schema"),
path("api_rschema/", SpectacularAPIView.as_view(), name="api-redoc-schema"),
2022-10-25 23:29:13 +03:00
path(
"api/docs/",
SpectacularSwaggerView.as_view(url_name="api-schema"),
2022-10-26 23:22:04 +03:00
name="home",
),
path(
"api/redoc/",
SpectacularRedocView.as_view(url_name="api-redoc-schema"),
name="home",
2022-10-25 23:29:13 +03:00
),
]
if settings.DEBUG:
# This allows the error pages to be debugged during development, just visit
# these url in browser to see how these error pages look like.
if "debug_toolbar" in settings.INSTALLED_APPS:
import debug_toolbar
urlpatterns = [path("__debug__/", include(debug_toolbar.urls))] + urlpatterns