mirror of
https://github.com/evraz-hack/backend.git
synced 2024-11-22 17:16:38 +03:00
37 lines
1.3 KiB
Python
37 lines
1.3 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 django.views import defaults as default_views
|
||
|
from django.views.generic import TemplateView
|
||
|
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
|