我试图在djangoGirls教程之后在pythonanywhere.com中部署我的网站。
当我运行我的网站时,它给了我这个错误:
运行WSGI应用程序时出错
ImportError:没有名为' whitenoise'
的模块文件" /var/www/cryptoassistant_pythonanywhere_com_wsgi.py",第7行,在模块>
来自whitenoise.django导入DjangoWhiteNoise
我的WGSI文件:
import os
import sys
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
from whitenoise.django import DjangoWhiteNoise
application = DjangoWhiteNoise(get_wsgi_application())
path = '/home/cryptoassistant/tfg/'
if path not in sys.path:
sys.path.append(path)
和我的setting.py文件:
MIDDLEWARE_CLASSES = (
'django.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)
我安装了whitenoise
$ pip install whitenoise
> Requeriment already satisfied: whitenoise in path (3.3.1)
我应该改变什么?
修改
我安装了冻结和我的要求:
-f /usr/share/pip-wheels
Django==1.8
freeze==1.0.10
six==1.11.0
whitenoise==3.3.1