[Answered ]-WSGIDaemonProcess does not affect python site

2👍

WSGIPythonHome

For virtualenv installations, you may need to specifically use WSGIPythonHome instead.

WSGIPythonHome ${RDOCROOT}/DOMAIN.COM/django-venv/

Configuring WSGIDaemonProcess with python-path

You may need to change the paths you provide:

WSGIDaemonProcess DOMAIN.COM python-path=${RDOCROOT}/DOMAIN.COM/wsgi:${RDOCROOT}/DOMAIN.COM/django-venv/lib/python3.4/site-packages/

to only use one of them (see also release notes for mod_wsgi 4.4.15)

WSGIDaemonProcess DOMAIN.COM python-path=${RDOCROOT}/DOMAIN.COM/django-venv/lib/python3.4/site-packages/

Recompiling for other python

In some instances, you may need to recompile mod_wsgi for that particular python version in addition to the WSGIPythonHome or python-path tricks.

Configuring site directly in wsgi application

As a last resort, you can configure site packages in the wsgi app.py:

import site
site.addsitedir('/opt/rh/httpd24/root/var/www/DOMAIN.COM/django-venv/lib/python3.4/site-packages')

mod_wsgi known issues with WSGIPythonPath

From the release notes for mod_wsgi 4.4.15:

  1. When specifying multiple directories for the Python module search path using the WSGIPythonPath directive, or the python-path option to WSGIDaemonProcess, it was failing under Python 3 due to incorrect logging. It was therefore only possible to add a single directory.
👤dnozay

Leave a comment