AssertionError using Apache2 and libapache2-mod-wsgi-py3 on Ubuntu 14.04 (Python 3.4)
Ubuntu 14.04 comes with mod_wsgi 3.4. According to https://code.djangoproject.com/ticket/22948#comment:2 we need to use mod_wsgi version 4.2+ for Python 3.4.
The best way to install mod_wsgi to the latest version is to get it with pip (can be in virtualenv) and then install its module to apache system-wide.
In my case I use virtualenv set in /venv_path
.
1) Remove problematic package and install dependency
sudo apt-get remove libapache2-mod-wsgi-py3
sudo apt-get install apache2-dev
2) Install mod_wsgi in virtualenv with pip
. /venv_path/bin/activate
pip install mod_wsgi
3) Install into Apache (system-wide)
sudo /venv_path/bin/mod_wsgi-express install-module
sudo vi /etc/apache2/mods-available/wsgi_express.load /etc/apache2/mods-available/wsgi_express.conf
Content of /etc/apache2/mods-available/wsgi_express.load
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi-py34.cpython-34m.so
Content of /etc/apache2/mods-available/wsgi_express.conf
WSGIPythonHome /venv_path
4) Enable the module and restart Apache.
sudo a2enmod wsgi_express
sudo service apache2 restart
5) Check that there are no errors in /var/log/apache2/error.log