WSGIPythonPath 无法识别虚拟环境

Virtual environment not recognized in WSGIPythonPath

我正在尝试使用虚拟环境在生产环境中设置我的 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 路径,但没有我的虚拟环境目录的踪迹。

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