Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#19208 closed Bug (fixed)

Daemon mode and mod_wsgi configuration.

Reported by: grahamd Owned by: aaugustin
Component: Documentation Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The mod_wsgi documentation at:

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

says:

"""
"Daemon mode" is the recommended mode for running mod_wsgi (on non-Windows platforms). See the official mod_wsgi documentation for details on setting up daemon mode. The only change required to the above configuration if you use daemon mode is that you can't use WSGIPythonPath; instead you should use the python-path option to WSGIDaemonProcess, for example:

WSGIDaemonProcess example.com python-path=/path/to/mysite.com:/path/to/venv/lib/python2.7/site-packages
"""

This information fails to mention that you also need to set WSGIProcessGroup to delegate the Django instance to run in the daemon process group. Worse is that it says 'The only change required to the above configuration if you use daemon mode'. Thus those who never actually read documentation properly and will just cut and paste will have issues.

Results is that keep seeing examples of people who have not done this and who have either done one of the following:

  1. Set WSGIPythonPath and python-path and then are oblivious to the fact that they aren't running in daemon mode and are still running in embedded mode.
  2. Don't set WSGIPythonPath and then get that Django settings module can't be found on startup because it doesn't know where to find it.

I noted this common problem of WSGIProcessGroup not being set in:

http://blog.dscpl.com.au/2012/10/why-are-you-using-embedded-mode-of.html

I didn't realise until now that Django documentation on mod_wsgi was contributing to that.

Suggest that:

"""
"Daemon mode" is the recommended mode for running mod_wsgi (on non-Windows platforms). See the official mod_wsgi documentation for details on setting up daemon mode. The only change required to the above configuration if you use daemon mode is that you can't use WSGIPythonPath; instead you should use the python-path option to WSGIDaemonProcess, for example:

WSGIDaemonProcess example.com python-path=/path/to/mysite.com:/path/to/venv/lib/python2.7/site-packages
"""

be changed to something like:

"""
"Daemon mode" is the recommended mode for running mod_wsgi (on non-Windows platforms). To create the required daemon process group and delegate the Django instance to run in it you will need to add appropriate WSGIDaemonProcess and WSGIProcessGroup directives. A further change required to the above configuration if you use daemon mode is that you can't use WSGIPythonPath; instead you should use the python-path option to WSGIDaemonProcess, for example:

WSGIDaemonProcess example.com python-path=/path/to/mysite.com:/path/to/venv/lib/python2.7/site-packages
WSGIProcessGroup example.com

See the official mod_wsgi documentation for details on setting up daemon mode.
"""

The link into the mod_wsgi documentation is probably best set to:

http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide#Delegation_To_Daemon_Process

Change History (5)

comment:1 Changed 2 years ago by claudep

  • Component changed from Uncategorized to Documentation
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Bug

comment:2 Changed 2 years ago by aaugustin

  • Owner changed from nobody to aaugustin

comment:3 Changed 2 years ago by Aymeric Augustin <aymeric.augustin@…>

  • Resolution set to fixed
  • Status changed from new to closed

In bc00075d51cd3e3b5f9a4d7d0f138e0a819adcb9:

Fixed #19208 -- Docs for mod_wsgi daemon mode

Thanks Graham Dumpleton for the patch.

comment:4 Changed 2 years ago by Aymeric Augustin <aymeric.augustin@…>

In a92c7c6e262a4374c9e92162017c2707ed1644c9:

[1.5.x] Fixed #19208 -- Docs for mod_wsgi daemon mode

Thanks Graham Dumpleton for the patch.

Backport of bc00075 from master.

comment:5 Changed 2 years ago by Aymeric Augustin <aymeric.augustin@…>

In 2733253633b8fa7663de2d95a356b92556cef551:

[1.4.x] Fixed #19208 -- Docs for mod_wsgi daemon mode

Thanks Graham Dumpleton for the patch.

Backport of bc00075 from master.

Note: See TracTickets for help on using tickets.
Back to Top