#25203: Document changes to WSGI application loading sequence in 1.7
-------------------------------------+-------------------------------------
Reporter: yscumc | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: 1.7
Severity: Normal | Resolution:
Keywords: wsgi setup | Triage Stage: Accepted
application loading |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by grahamd):
Where you need a process level global variable inherited from some key set
in the Apache configuration, what you are best to do is ensure you are
running the Django application in a mod_wsgi daemon process group of its
own (forced to use main interpreter application group), and then base any
in code decisions on the name of the daemon process group you used in the
Apache configuration.
For example, you could even have the name of the Django settings module be
the name of the daemon process group.
{{{
WSGIDaemonProcess mysite.production.settings
WSGIScriptAlias / /some/path/wsgi.py process-
group=mysite.production.settings application-group=%{GLOBAL}
}}}
In the `wsgi.py` file you can then say:
{{{
try:
import mod_wsgi
os.environ['DJANGO_SETTINGS_MODULE'] = mod_wsgi.process_group
except ImportError:
os.environ.setdefault('DJANGO_SETTINGS_MODULE',
'mysite.development.settings')
}}}
This can be placed before any other module imports as it is dependent on
information available at import time and not at the time of a request.
--
Ticket URL: <https://code.djangoproject.com/ticket/25203#comment:11>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.b2124e049ff00431aa583cf02c5eb3bd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.