虽然存在于系统范围内,但未找到python virtualenv os.py.

时间:2018-01-30 17:06:44

标签: python django virtualenv

使用virtualenv版本1.10.1我创建了/var/www/vhosts/example.com/django-app-env/但是使用以下passenger_wsgi.py

运行它
import sys, os
app_name = 'app'
env_name = 'django-app-venv'

cwd = os.getcwd()
sys.path.append(cwd)
sys.path.append(cwd + '/' + app_name)

INTERP = cwd + '/' + env_name + '/bin/python'
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)

sys.path.insert(0, cwd + '/' + env_name + '/bin')
sys.path.insert(0, cwd + '/' + env_name + '/lib/python2.7/site-packages/django')
sys.path.insert(0, cwd + '/' + env_name + '/lib/python2.7/site-packages')

os.environ.setdefault("DJANGO_SETTINGS_MODULE", app_name + ".settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

我明白了......

Traceback (most recent call last):
File "/usr/share/passenger/helper-scripts/wsgi-loader.py", line 325, in <module> app_module = load_app()
File "/usr/share/passenger/helper-scripts/wsgi-loader.py", line 62, in load_app
return imp.load_source('passenger_wsgi', startup_file)
File "/var/www/vhosts/example.com/httpdocs/passenger_wsgi.py", line 10, in <module>
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
File "/var/www/vhosts/example.com/django-app-env/lib64/python2.7/os.py", line 312, in execl
execv(file, args)
OSError: [Errno 2] No such file or directory

它的Python 2.7.5

为什么?

0 个答案:

没有答案