0

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.

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134
Ruben
  • 1,065
  • 5
  • 18
  • 44

1 Answers1

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.

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134
  • How can I keep both of them? I have in the same server some other projects using Python2.7. – Ruben Oct 17 '16 at 06:42
  • 1
    You can't use multiple Python versions within the same Apache instance. Consider looking at mod_wsgi-express and have it sitting behind your main Apache, where the main Apache acts as a proxy to it. If sound like an option, then jump on the mod_wsgi mailing list and ask about it there as that is better place to discuss it. http://modwsgi.readthedocs.io/en/develop/finding-help.html – Graham Dumpleton Oct 17 '16 at 07:16