Django版本:2.2.1
settings文件中的配置
if DEBUG is True:
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'edu/dist/static/'), # 添加内容
]
else:
STATIC_ROOT = os.path.join(BASE_DIR, 'edu/dist/static/')
urls.py
from django.views import static
from django.conf import settings
from django.conf.urls import url
url(r'^static/(?P<path>.*)$', static.serve, {'document_root': settings.STATIC_ROOT}, name='static'),