Virtual environment not recognized in WSGIPythonPa

2019-06-14 05:08发布

I'm trying to set up my Django project in production by using a virtual environment, using the documentation:

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

So, in my configuration I have:

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

I restart Apache and I get the following error:

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']

However the error is something because that library is not used anymore in Python3. I see the python path and no trace of my virtual environment directory.

1条回答
做个烂人
2楼-- · 2019-06-14 05:43

Your mod_wsgi is compiled for Python 2.7. You cannot point it at a virtual environment for Python 3.4. You must uninstall mod_wsgi and install a mod_wsgi version built for Python 3.4, the same version as your virtual environment.

查看更多
登录 后发表回答