From 323be38d38be7e6fbf1eea35e9b8329e58de13e2 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sun, 28 Apr 2024 13:59:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20base=20=E7=94=9F=E4=BA=A7=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=85=B3=E9=97=ADswagger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/urls.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/server/urls.py b/server/urls.py index ac84d8a9..7be6cba0 100755 --- a/server/urls.py +++ b/server/urls.py @@ -67,15 +67,17 @@ urlpatterns = [ path('', include('apps.pm.urls')), path('', include('apps.enp.urls')), - - - # api文档 - 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'), # 前端页面入口 path('', TemplateView.as_view(template_name="index.html")), ] + \ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + \ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + +if settings.DEBUG: + urlpatterns += [ + # api文档 + 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'), + ] \ No newline at end of file