【发布时间】:2016-11-12 14:34:08
【问题描述】:
我正在尝试在 Dreamhost 共享主机上使用 Django 1.9(使用 Python 3.4)。
我遵循了这个教程: https://brobin.me/blog/2015/03/deploying-django-with-virtualenv-on-dreamhost/
现在我的passenger_wsgi.py是这样的:
import sys, os
cwd = os.getcwd()
sys.path.append(cwd)
sys.path.append(cwd + '/my_project')
INTERP = os.path.expanduser("~/venv/bin/python")
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
sys.path.insert(0,'$HOME/venv/bin')
sys.path.insert(0,'$HOME/venv/lib/python3.4/site-packages/django')
sys.path.insert(0,'$HOME/venv/lib/python3.4/site-packages')
os.environ['DJANGO_SETTINGS_MODULE'] = "my_project.settings"
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
问题是Passenger启动,当我访问该站点时,Passenger显示此错误:
Web application could not be started
An error occurred while starting the web application. It exited before signalling successful startup back to Phusion Passenger. Please read this article for more information about this problem.
Raw process output:
Traceback (most recent call last):
File "/dh/passenger/helper-scripts/wsgi-loader.py", line 320, in <module>
app_module = load_app()
File "/dh/passenger/helper-scripts/wsgi-loader.py", line 61, in load_app
return imp.load_source('passenger_wsgi', startup_file)
File "passenger_wsgi.py", line 8, in <module>
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
File "/usr/lib/python2.7/os.py", line 312, in execl
execv(file, args)
OSError: [Errno 2] No such file or directory
我真的不明白Passenger是如何工作的,我认为这个问题与this有关,但我不知道如何让它工作。
任何帮助将不胜感激。非常感谢。
【问题讨论】:
标签: python django passenger dreamhost