WSGIPythonPath中无法识别虚拟环境

时间:2016-10-14 12:46:56

标签: django apache python-3.x virtualenv mod-wsgi

我尝试使用虚拟环境在生产中设置我的Django项目,使用文档:

https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/modwsgi/#using-a-virtualenv

所以,在我的配置中,我有:

WSGIPythonPath /srv/zboss/zboss:/srv/zboss/venv/lib/python3.4/site-packages

我重新启动Apache,我收到以下错误:

Internal Server Error: /prot/

InvalidTemplateLibrary at /
Invalid template library specified. ImportError raised when trying to load 'core.templatetags.wiki_formatter': No module named parse

Request Method: GET
Request URL: http://babylon/prot/
Django Version: 1.10.1
Python Executable: /usr/bin/python
Python Version: 2.7.6
Python Path: ['/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/srv/zboss/zboss']

然而,错误是因为Python3中不再使用该库。我看到了python路径,没有我虚拟环境目录的踪迹。

1 个答案:

答案 0 :(得分:1)

您的mod_wsgi是为Python 2.7编译的。您无法将其指向Python 3.4的虚拟环境。您必须卸载mod_wsgi并安装为Python 3.4构建的mod_wsgi版本,该版本与您的虚拟环境版本相同。

相关问题