【发布时间】:2020-09-07 19:55:33
【问题描述】:
我收到 500 服务器错误,因为我的静态文件似乎有问题:
我的项目文件夹名称是注册,我有不同的生产和开发设置文件:
register
--live-static
--register
----settings
------__init__.py
-----common.py
-----production.py
-----development.py
--live-static
--static
在我的production.py 文件中,我有:
from register.settings.common import *
import django_heroku
django_heroku.settings(locals())
DEBUG = False
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
STATIC_ROOT = os.path.join(BASE_DIR, 'live-static', 'static-root')
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'live-static', 'media-root'
我已经跑过:
python manage.py collect static
heroku run python manage.py collectstatic
我得到了以下结果:
1626 static files copied to '/app/live-static/static-root', 4464 post-processed.
但是,在我访问我的网站后,我收到了一个错误:
raise ValueError("Missing staticfiles manifest entry for '%s'" % clean_name)
2020-09-07T19:46:28.324481+00:00 app[web.1]: ValueError: Missing staticfiles manifest entry for 'css/main.css'
在我的模板中我有{% static 'css/main.css' %}
我不知道为什么我仍然收到错误,因为我的 collect static 已经正常工作。 如有任何帮助,我将不胜感激。
【问题讨论】: