On Thursday, 23 May 2013 07:57:02 UTC+10, ke1g wrote:
Since my Apache virtualhost file contains
WSGIDaemonProcess mysite.local python-path=/my/python/path:/path/to/my/project/venv/lib/python2.7/site-packages
If memory serves, this does not cause the .pth files in site-packages to be applied. Could be OK. Could be a problem.
It has processed .pth files and ensured that path ordering is done as necessary since mod_wsgi 2.0.
WSGIProcessGroup mysite.local
WSGIScriptAlias / /path/to/my/project/wsgi.py
This wouldn't be the wsgi.py created by manage.py startproject, would it? It's necessary these days for manag.py runserver, but I've yet to find it adequate to use with mod_wsgi. (I must confess that I haven't played with it for at least 6 months.) It's not too hard to write your own, taking all the path manipulations, that runserver doesn't need but mod_wsgi does, into account.
Except for setdefault() being used to set environment variables causing issues in some cases:
the generated wsgi.py file should be fine, you can do all the path setup from mod_wsgi.
A reasonable configuration if using mod_wsgi 3.4 would be:
WSGIApplicationGroup %{GLOBAL}
WSGIRestrictEmbedded On
This is mostly covered in:
with the exception that using python-home in this example.
The WSGIRestrictEmbedded directive turns off Python in the Apache worker processes since you are using a daemon process group. Saves on memory and CPU startup cost of worker processes.
The WSGIApplicationGroup with value %{GLOBAL} for daemon process forces use of main interpreter, avoiding creation of a second sub interpreter context and avoids issues with some third party C extension modules which do not work properly in sub interpreters.
Graham