不能与Heroku一起使用django-compress

thu*_*ief 8 python django heroku

我有一个部署到Heroku的Django 1.9.6站点.当DEBUG=False我收到服务器错误(500).日志中没有包含有用的信息,因此我尝试使用它DEBUG=True.现在它工作正常.我认为这个问题可能与我的scss文件处理有关,这让我很困惑,而且我正在努力.我最近 - 除其他外 - 添加COMPRESS_OFFLINE = True到我的设置文件,并评论出来似乎缓解了问题(虽然我的scss文件不起作用).

我的一些静电settings.py.让我知道你是否需要更多 - 这对我来说是个谜.我试图尽可能地遵循一点.

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, "media/")
    STATICFILES_FINDERS = (
        'django.contrib.staticfiles.finders.FileSystemFinder',
        'django.contrib.staticfiles.finders.AppDirectoriesFinder',
        # other finders..
        'compressor.finders.CompressorFinder',
    )

    STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

    MEDIA_URL = "/media/"
    MEDIA_ROOT = os.path.join(BASE_DIR, "media/")
Run Code Online (Sandbox Code Playgroud)

urls.py:

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

urlpatterns += [
    url(r'^media/(?P<path>.*)$', serve, {
        'document_root': settings.MEDIA_ROOT
    }),
]

urlpatterns += staticfiles_urlpatterns()
Run Code Online (Sandbox Code Playgroud)

编辑:

我已经登录工作,我已经确认这是一个压缩错误.我收到错误消息:

Internal Server Error: /

OfflineGenerationError at /
You have offline compression enabled but key "171c3b7763dbc51a465d996f7d920cf5" is missing from offline manifest. You may need to run "python manage.py compress".
Run Code Online (Sandbox Code Playgroud)

除了运行建议的命令解决了它之外,我在本地获得了同样的东西.运行heroku run python manage.py compress没有效果(运行它没有错误)

thu*_*ief 3

压缩生成的清单存储在我的 .gitignore 中,因此生产中的清单已过时。将其添加到 git 存储库修复了一切。