小编Nat*_*mes的帖子

ValueError:使用 Docker、django-pipeline、whitenoise 在 Heroku 上缺少静态文件清单条目

我正在尝试使用 Docker、django-pipeline 和 Whitenoise 在 Heroku 上部署 Django 项目。容器构建成功,我看到collectstaticcontainer-name/static. 但是,在访问任何页面时,我都会收到以下 500 错误:

ValueError: Missing staticfiles manifest entry for 'pages/images/favicons/apple-touch-icon-57x57.png'
Run Code Online (Sandbox Code Playgroud)

下面是我的settings.pyDockerfile、 和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)

django heroku django-pipeline docker whitenoise

4
推荐指数
1
解决办法
1738
查看次数

标签 统计

django ×1

django-pipeline ×1

docker ×1

heroku ×1

whitenoise ×1