mirror of
https://github.com/magnum-opus-nn-cp/backend.git
synced 2024-11-10 18:06:33 +03:00
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
|
from django.conf import settings
|
||
|
from django.conf.urls.static import static
|
||
|
from django.contrib import admin
|
||
|
from django.urls import include, path
|
||
|
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView
|
||
|
from rest_framework.authtoken.views import obtain_auth_token
|
||
|
|
||
|
urlpatterns = [
|
||
|
# Django Admin, use {% url 'admin:index' %}
|
||
|
path(settings.ADMIN_URL, admin.site.urls),
|
||
|
# User management
|
||
|
# 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")),
|
||
|
# DRF auth token
|
||
|
path("api/auth/token/", obtain_auth_token),
|
||
|
path("api/schema/", SpectacularAPIView.as_view(), name="api-schema"),
|
||
|
path(
|
||
|
"api/docs/",
|
||
|
SpectacularSwaggerView.as_view(url_name="api-schema"),
|
||
|
name="api-docs",
|
||
|
),
|
||
|
]
|
||
|
|
||
|
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
|