mirror of
https://github.com/Ai-hack-MAGNUM-OPUS/backend.git
synced 2024-11-22 00:06:34 +03:00
47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
from django.conf.urls.static import static
|
|
from django.contrib import admin
|
|
from django.urls import path, include, re_path
|
|
from drf_yasg import openapi
|
|
from drf_yasg.views import get_schema_view
|
|
from rest_framework import permissions
|
|
|
|
from django.conf import settings
|
|
|
|
schema_view = get_schema_view(
|
|
openapi.Info(
|
|
title="API",
|
|
default_version="v1",
|
|
description="openapi schema",
|
|
contact=openapi.Contact(email="alexander.d.karpov@gmail.com"),
|
|
),
|
|
validators=["ssv"],
|
|
public=True,
|
|
permission_classes=[permissions.AllowAny],
|
|
)
|
|
|
|
urlpatterns = [
|
|
# Django Admin, use {% url 'admin:index' %}
|
|
path("admin/", admin.site.urls),
|
|
path("api/", include("conf.api_router")),
|
|
re_path(
|
|
r"^swagger(?P<format>\.json|\.yaml)$",
|
|
schema_view.without_ui(cache_timeout=0),
|
|
name="schema-json",
|
|
),
|
|
re_path(
|
|
r"^swagger/$",
|
|
schema_view.with_ui("swagger", cache_timeout=0),
|
|
name="schema-swagger-ui",
|
|
),
|
|
re_path(
|
|
r"^redoc/$",
|
|
schema_view.with_ui("redoc", cache_timeout=0),
|
|
name="schema-redoc",
|
|
),
|
|
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
|
|
|
if settings.DEBUG:
|
|
import debug_toolbar
|
|
|
|
urlpatterns = [path("__debug__/", include(debug_toolbar.urls))] + urlpatterns
|