我正在尝试在PythonAnywhere上部署我的webapp并遇到一个问题,它只是给我一个错误代码:Unhandled Exception页面。我在错误日志中收到以下错误:
2016-07-21 06:41:49,331 :Error running WSGI application
Traceback (most recent call last):
File "/bin/user_wsgi_wrapper.py", line 154, in __call__
app_iterator = self.app(environ, start_response)
File "/bin/user_wsgi_wrapper.py", line 170, in import_error_application
raise e
File "/bin/user_wsgi_wrapper.py", line 154, in __call__
app_iterator = self.app(environ, start_response)
File "/bin/user_wsgi_wrapper.py", line 170, in import_error_application
raise e
File "/bin/user_wsgi_wrapper.py", line 179, in <module>
application = load_wsgi_application()
File "/bin/user_wsgi_wrapper.py", line 175, in load_wsgi_application
return __import__(os.environ['WSGI_MODULE'], globals(), locals(), ['application']).application
File "/var/www/www_mywandermust_com_wsgi.py", line 12, in <module>
application = StaticFilesHandler(get_wsgi_application())
File "/usr/local/lib/python3.5/dist-packages/django/core/wsgi.py", line 13, in get_wsgi_application
django.setup()
File "/usr/local/lib/python3.5/dist-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.5/dist-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python3.5/dist-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named 'allauth'
我已经在服务器系统中安装了django-allauth,一切都在我的本地安装上完美运行。我也能在控制台中找到allauth的路径:
(venv) 06:49 ~/carmen (master)$ python -i /var/www/www_mywandermust_com_wsgi.py
>>> import allauth
>>> print (allauth)
<module 'allauth' from '/home/gsussman/carmen/venv/lib/python3.5/site-packages/allauth/__init__.py'>
这是我的WSGI文件:
import os
import sys
path = '/home/gsussman/carmen' # use your own username here
if path not in sys.path:
sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'travelapp.settings'
from django.core.wsgi import get_wsgi_application
from django.contrib.staticfiles.handlers import StaticFilesHandler
application = StaticFilesHandler(get_wsgi_application())
答案 0 :(得分:2)
<div class="gallery">
<div class="picture">
<img id="main-product-img-43" src="//images/thumbs/0000072_25-virtual-gift-card_550.jpeg">
</div>
</div>
安装在virtualenv(它叫做venv)中。你的网络应用程序显然没有使用那个virtualenv(回溯中提到的Django在/ usr / local中,而不是在venv中)