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