增加swagger.json

This commit is contained in:
caoqianming 2021-08-30 09:57:51 +08:00
parent d85f52454c
commit 03f88f89c1
1 changed files with 2 additions and 0 deletions

View File

@ -18,6 +18,7 @@ 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.conf.urls import url
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
from rest_framework import routers
@ -47,6 +48,7 @@ urlpatterns = [
# api文档
path('api/docs/', include_docs_urls(title="接口文档", authentication_classes=[], permission_classes=[])),
url(r'^api/swagger(?P<format>\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'),
path('api/swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
path('api/redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),