How to install & configure mod_wsgi for py3 How to install & configure mod_wsgi for py3 python python

How to install & configure mod_wsgi for py3


sudo apt-get install libapache2-mod-wsgi-py3

This will replace libapache2-mod-wsgi and will restart the apache service.

More specific instructions (Django) are available for here: https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/modwsgi/


It is incorrect to say you do not need to install it again. Graham Dumpleton (the author of the mod_wsgi module) addressed the issue here.

Short answer - you will need to install the mod_wsgi compiled for your updated Python. I had the very same issue - as far as I can remember you need to get the correct pip for your Python version and run something along the lines of this:

sudo pip3.x install --target=/path/to/python3.x/site-packages mod_wsgi


If you are using virtualenvs (which you should) you would simply build one out for the version of python you want to build mod_wsgi for.

$ mkvirtualenv --python=/usr/bin/python3 myvenv

Then

(myvenv) $ pip install mod_wsgi 

will build a Python3 version for you.