Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #18518 -- Add warning re mod_wsgi and wsgi.py environ handling.

  • Loading branch information...
commit 751a7d0c32746dc6774f1b561db523b25365148a 1 parent e44bedd
Carl Meyer authored September 27, 2012
4  django/conf/project_template/project_name/wsgi.py
@@ -15,6 +15,10 @@
15 15
 """
16 16
 import os
17 17
 
  18
+# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
  19
+# if running multiple sites in the same mod_wsgi process. To fix this, use
  20
+# mod_wsgi daemon mode with each site in its own daemon process, or use
  21
+# os.environ["DJANGO_SETTINGS_MODULE"] = "{{ project_name }}.settings"
18 22
 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
19 23
 
20 24
 # This application object is used by any WSGI server configured to use this
11  docs/howto/deployment/wsgi/modwsgi.txt
@@ -56,6 +56,15 @@ for you; otherwise, you'll need to create it. See the :doc:`WSGI overview
56 56
 documentation</howto/deployment/wsgi/index>` for the default contents you
57 57
 should put in this file, and what else you can add to it.
58 58
 
  59
+.. warning::
  60
+
  61
+   If multiple Django sites are run in a single mod_wsgi process, all of them
  62
+   will use the settings of whichever one happens to run first. This can be
  63
+   solved with a minor edit to ``wsgi.py`` (see comment in the file for
  64
+   details), or by :ref:`using mod_wsgi daemon mode<daemon-mode>` and ensuring
  65
+   that each site runs in its own daemon process.
  66
+
  67
+
59 68
 Using a virtualenv
60 69
 ==================
61 70
 
@@ -71,6 +80,8 @@ Make sure you give the correct path to your virtualenv, and replace
71 80
 
72 81
 .. _virtualenv: http://www.virtualenv.org
73 82
 
  83
+.. _daemon-mode:
  84
+
74 85
 Using mod_wsgi daemon mode
75 86
 ==========================
76 87
 

0 notes on commit 751a7d0

Please sign in to comment.
Something went wrong with that request. Please try again.