我正在尝试使用 Docker、django-pipeline 和 Whitenoise 在 Heroku 上部署 Django 项目。容器构建成功,我看到collectstatic在container-name/static. 但是,在访问任何页面时,我都会收到以下 500 错误:
ValueError: Missing staticfiles manifest entry for 'pages/images/favicons/apple-touch-icon-57x57.png'
Run Code Online (Sandbox Code Playgroud)
下面是我的settings.py、Dockerfile、 和heroku.yml。由于我也在使用 django-pipeline,所以我不确定的一件事是使用什么设置STATICFILES_STORAGE?我试过
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
Run Code Online (Sandbox Code Playgroud)
但这会导致文件路径404ing。
任何建议表示赞赏。谢谢。
#settings.py
...
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.bool("DJANGO_DEBUG", default=False)
ALLOWED_HOSTS = ['.herokuapp.com', 'localhost', '127.0.0.1']
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.admindocs",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.sites",
# Third-party
"allauth",
"allauth.account",
"debug_toolbar",
"django_extensions",
"pipeline",
"rest_framework", …Run Code Online (Sandbox Code Playgroud)