From a6b97a2ebaad75755da0066fddf45b92fce24b15 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 26 Mar 2021 16:26:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/server/settings.py | 2 +- server/server/urls.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/server/server/settings.py b/server/server/settings.py index 4de621e..cf82f74 100644 --- a/server/server/settings.py +++ b/server/server/settings.py @@ -123,7 +123,7 @@ CORS_ORIGIN_ALLOW_ALL = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.0/howto/static-files/ -STATIC_URL = '/api/static/' +STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') MEDIA_URL = '/media/' diff --git a/server/server/urls.py b/server/server/urls.py index acaa3d7..11f10bb 100644 --- a/server/server/urls.py +++ b/server/server/urls.py @@ -67,5 +67,4 @@ urlpatterns = [ path('api/supervision/', include('apps.supervision.urls')), path('api/docs/', include_docs_urls(title="接口文档",authentication_classes=[], permission_classes=[])), path('api/', include(router.urls)), - url(r'^api/static/(?P.*)$', serve,{'document_root': settings.STATIC_ROOT}, name='static'), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)