我尝试在django 1.3和passsenger wsgi上运行古代应用程序。
我的passenger_wsgi.py是:
import sys, os
INTERP = sys.path.append(os.path.join(os.getcwd(), 'myvenv/bin/python'))
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
sys.path.append(os.getcwd())
os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
我收到下一个错误:
Raw process output:
Traceback (most recent call last):
File "/opt/passenger/helper-scripts/wsgi-loader.py", line 320, in <module>
app_module = load_app()
File "/opt/passenger/helper-scripts/wsgi-loader.py", line 61, in load_app
return imp.load_source('passenger_wsgi', startup_file)
File "passenger_wsgi.py", line 4, in <module>
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
File "/home/gian/virtualenv/public__html_test_gian/2.7/lib64/python2.7/os.py", line 314, in execl
execv(file, args)
TypeError: coercing to Unicode: need string or buffer, NoneType found
编辑:
我已经在右边的
'/home/gian/public_html/test/gian/myvenv/bin/python'
上更改了INTERP变量现在我得到下一个:
'Traceback (most recent call last):
File "/opt/passenger/helper-scripts/wsgi-loader.py", line 320, in <module>
app_module = load_app()
File "/opt/passenger/helper-scripts/wsgi-loader.py", line 61, in load_app
return imp.load_source('passenger_wsgi', startup_file)
File "passenger_wsgi.py", line 4, in <module>
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
File "/home/gian/virtualenv/public__html_test_gian/2.7/lib64/python2.7/os.py", line 314, in execl
execv(file, args)
OSError: [Errno 13] Permission denied'
最佳答案
os.path.append
返回None
,请将文件路径提供给INTERP
变量。
您可能不得不使用
INTERP = os.path.join(os.getcwd(), 'myvenv/bin/python')
sys.path.append(INTERP)