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:

http://blog.dscpl.com.au/2012/10/requests-running-in-wrong-django.html

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:

WSGIDaemonProcess example.com 
python-home=/path/to/your/venv python-path=/path/to/mysite.com
WSGIProcessGroup example.com
WSGIApplicationGroup %{GLOBAL}
WSGIRestrictEmbedded On

WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py

This is mostly covered in:

https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to