On Nov 10, 5:50 pm, "DULMANDAKH Sukhbaatar" <[EMAIL PROTECTED]>
wrote:
> > Ok.  But are the configuration lines any different or will they
> > change.  If anyone has a good tutorial written could you please post
> > it.  Also, What does this line mean ?
> > SetEnv DJANGO_SETTINGS_MODULE mysite.settings
>
> See http://httpd.apache.org/docs/2.2/mod/mod_env.html. I suggest you
> to do some research by yourself.

Note that SetEnv in Apache is traditionally used for CGI scripts and
would dictate what operating system environment variables are set in
the separate process created to run the CGI script. It does not in
itself change operating system environment variables for the Apache
child worker processes where Django runs itself.

When Django is run with mod_python however, Django is taking the
variables set by SetEnv and forcibly updating os.environ and as a side
affect also updating the operating system environment variables as
well. This is actually somewhat bad practice for anything running
directly under an Apache module as it will affect code running under
other Apache modules as well, eg, PHP. Things can get even worse if
running multiple Django instances in a multithreaded server
configuration and setting overlapping sets of variables to different
values as you can end up with race conditions on values of operating
system environment variables as seen by C code or other Apache
modules.

In other words, it isn't that simple and Django in the long term
should target getting rid of reliance on variables in os.environ.

FWIW, with mod_wsgi anything defined using SetEnv only populates the
per request WSGI environment dictionary and not the process level
operating system environment variables. At this stage though, Django
cannot use per request environment that WSGI provides and so manual
step of setting os.environ still required. At least updating
os.environ is only done once when WSGI script loaded and not on every
request like mod_python.

So, it isn't as simple as you may think. :-)

Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to