django heroku whitenoise issute(与静态文件加载有关)

时间:2019-01-24 03:24:09

标签: django heroku deployment

通过 heroku日志--tail ,我遇到了以下错误:

  

ImportError:    您的WhiteNoise配置与WhiteNoise v4.0不兼容

  

django.core.exceptions.ImproperlyConfigured:WSGI应用程序   无法加载“ myproject.wsgi.application”;导入错误   模块。

在我的wsgi.py中(我有意删除了与白噪声相关的行):

import os
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'notetaking.settings')
application = Cling(get_wsgi_application())

在Procfile中:

worker: gunicorn --pythonpath notetaking notetaking.wsgi

在prod_settings.py

from .settings import *
STATIC_ROOT='staticfiles'
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO','https')
ALLOWED_HOSTS = ['*']
DEBUG = False
import dj_database_url
DATABASES = {
    'default': dj_database_url.config()
}
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

in requirements.py

dj-database-url==0.5.0
dj-static==0.0.6
Django==2.1.5
djangorestframework==3.9.1
gunicorn==19.9.0
mysqlclient==1.3.13
numpy==1.16.0
pandas==0.23.4
Pillow==5.4.1
psycopg2==2.7.7
python-dateutil==2.7.5
pytz==2018.9
six==1.12.0
static3==0.7.0
virtualenv==16.2.0
whitenoise==4.0
xlrd==1.2.0

0 个答案:

没有答案