From a3c6be5adaf82bcdb1953d61d0562dfca7ea752c Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 26 Mar 2021 15:54:09 +0800 Subject: [PATCH] =?UTF-8?q?static=20=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/server/settings.py | 4 ++-- server/server/urls.py | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/server/server/settings.py b/server/server/settings.py index 3f28a85..4276ac8 100644 --- a/server/server/settings.py +++ b/server/server/settings.py @@ -123,9 +123,9 @@ CORS_ORIGIN_ALLOW_ALL = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.0/howto/static-files/ -STATIC_URL = '/static/' +STATIC_URL = '/api/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') -STATICFILES_DIRS =[os.path.join(BASE_DIR, 'dist/static')] +STATICFILES_DIRS =[os.path.join(BASE_DIR, 'static')] MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') diff --git a/server/server/urls.py b/server/server/urls.py index 7c0a0b3..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'^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)