[Fixed]-Apache with virtualenv and mod_wsgi : ImportError : No module named 'django'


You are missing a WSGIProcessGroup directive or equivalent option on WSGIScriptAlias, so your application isn’t actually being run in that daemon process group where you have set the virtual environment.

See Using mod_wsgi daemon mode

I would also recommend ensuring application group is set to ‘%{GLOBAL}’ if that is the only application you are running in the daemon process group.

Thus use:

WSGIScriptAlias / /path/to/project/project/wsgi.py \
    process-group=project application-group=%{GLOBAL}

Also better to use python-home for the virtual environment.

    WSGIDaemonProcess project python-path=/path/to/project \



My rep is not over 50 so I cannot comment, but I’d like to share my discovery.

In WSGIDaemonProcess, if you are using Python 3.5, you need to set exactly as @graham-dumpleton say, with


set explicitly.

However, if you are using Python 3.4 (or some older version Python like 2.7 as far as I know), you’ll have to configure it as


just like what the asker did.

Really weird.


For me the problem was I had mod wsgi installed for python2. I had to reinstall it for python3:

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


The issue for me was that I was running libapache2-mod-wsgi-py3 on python version 3.9. When I rolled back the python version to 3.7, there was no issue.

Leave a comment