36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
from django.urls.conf import path
|
|
from drf_yasg import openapi
|
|
from drf_yasg.views import get_schema_view
|
|
from rest_framework import permissions
|
|
|
|
# from rest_framework_swagger.views import get_swagger_view
|
|
# from rest_framework.routers import DefaultRouter
|
|
# from content.views import QuestionViewSet
|
|
# schema_view = get_swagger_view(title='TablequizDB API')
|
|
# router = DefaultRouter()
|
|
# router.register(r'question', QuestionViewSet)
|
|
# urlpatterns = [
|
|
# path('docs/', schema_view, name='api-v1'),
|
|
# path('v1/', include(router.urls)),
|
|
# ]
|
|
|
|
|
|
schema_view = get_schema_view(
|
|
openapi.Info(
|
|
title="TabelquizDB API",
|
|
default_version='v1',
|
|
description="The API",
|
|
# terms_of_service="https://www.google.com/policies/terms/",
|
|
contact=openapi.Contact(email="api@tablequizdb.de"),
|
|
license=openapi.License(name="BSD License"),
|
|
),
|
|
public=True,
|
|
permission_classes=(permissions.AllowAny,),
|
|
)
|
|
|
|
urlpatterns = [
|
|
path('swagger<format>/', schema_view.without_ui(cache_timeout=0), name='schema-json'),
|
|
path('', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
|
|
path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
|
|
]
|