[Fixed]-Virtualenv isolated app somehow finds global django installation instead of local one

1👍

Try:

WSGIRestrictEmbedded On

<VirtualHost *:80>

    WSGIDaemonProcess mydomain.com python-home=/root/.virtualenvs/myenv python-path=/var/djp/myapp
    WSGIProcessGroup mydomain.com
    WSGIPassAuthorization On

    WSGIScriptAlias / /var/djp/myapp/myapp/wsgi.py
    ServerName mydomain.com
    ServerAlias *.mydomain.com
    ErrorLog ${APACHE_LOG_DIR}/myapp/myapp_error.log
    LogLevel info

</VirtualHost>

That is, turn off interpreter initialisation in embedded mode processes and then use python-home option to say where virtual environment is.

The remaining question is whether you are using a non system Python installation. If you are and mod_wsgi was actually compiled for system Python and not your separate one, more work is needed.

A further issue may also be that /root directories are not actually readable to Apache user.

Leave a comment