Virtual environment not recognized in WSGIPythonPath

有些话、适合烂在心里 提交于 2019-12-08 11:29:57

问题


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:


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.



来源:https://stackoverflow.com/questions/40043543/virtual-environment-not-recognized-in-wsgipythonpath

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!