[英]--no-site-packages with Apache mod_wsgi
I installed Django 1.5 to a virtual enviroment created with --no-site-packages option. 我将Django 1.5安装到使用--no-site-packages选项创建的虚拟环境中。
Although site-packges path of virtualenv is added to ystem path in wsgi file, Apache ignores the Django1.5 and uses Django 1.3 (installed to global python library previously) 尽管virtualenv的site-packges路径已添加到wsgi文件的ystem路径中,但是Apache会忽略Django1.5并使用Django 1.3(先前已安装到全局python库中)
What may cause this problem and how can I resolve it? 可能导致此问题的原因如何解决? You can find my django.wsgi file below and I can provide any neccessary information. 您可以在下面找到我的django.wsgi文件,并且我可以提供任何必要的信息。
django.wsgi django.wsgi
import os
import sys
import site
vepath = '/home/myuser/projects/myenviron/lib/python2.7/site-packages'
site.addsitedir(vepath)
sys.path.append('/home/myuser/projects/')
sys.path.append('/home/myuser/projects/myproject/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
You must be using a quite old version of virtualenv as the --no-site-packages option is deprecated these days as it is the default. 您必须使用旧版本的virtualenv,因为--no-site-packages选项最近已弃用,因为它是默认选项。 Thus you shouldn't need to be explicitly providing it. 因此,您不需要显式提供它。
Anyway, read: 无论如何,请阅读:
Better still, use mod_wsgi daemon mode and the python-home option. 更好的是,使用mod_wsgi守护程序模式和python-home选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.