【发布时间】:2015-08-27 21:53:20
【问题描述】:
Django 代码在本地正确地提供静态 css 文件,但在推送到 Heroku 时不能。
推送过程包括运行 collectstatic,它似乎在 css 文件名上附加了一些内容。查看 Heroku 提供的索引页面的来源是这样的:
<link href="/static/mycssfile.cba06cddbdea.css" rel="stylesheet" type="text/css"/>
该文件作为 mycssfile.css 存在于预期的静态文件夹中的 heroku 中。
所有管理静态文件都已正确收集和提供。这是静态设置。这在由工头服务时有效。
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.FileSystemFinder',
)
STATIC_ROOT = os.path.join(PROJECT_ROOT,'static')
STATIC_URL = '/static/'
【问题讨论】: