修改setting文件增加STATIC_ROOT配置
STATIC_ROOT = os.path.join(BASE_DIR, "/static/")
修改urls.py文件
from django.conf import settings from django.conf.urls.static import static urlpatterns = [ # ... the rest of your URLconf goes here ... ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
DEBUG = True时生效