【发布时间】:2020-02-01 11:47:29
【问题描述】:
raise ValueError("Missing staticfiles manifest entry for '%s'" % clean_name) ValueError:当 DEBUG = False 时缺少“favicon.png”的静态文件清单条目
我只在 DEBUG = False 时得到这个错误,当 DEBUG = True 时我没有得到任何错误
要在保持 DEBUG = False 的同时解决此问题,我必须将 favicon.png(我之前删除过)添加回 static_root 文件夹,然后运行 python manage.py collectstatic
我检查了所有文件,所有 html 文档都将链接 favicon.png 行注释掉了,所以这不是问题。
settings.py 有以下内容:
STATIC_URL = '/static/'
STATICFILES_DIRS =[
os.path.join(BASE_DIR, 'static_root'),
]
VENV_PATH = os.path.dirname(BASE_DIR)
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
urls.py 有以下内容:
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
【问题讨论】:
标签: django django-staticfiles django-static