Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.0.X] Fixed #9970: added mod_wsgi docs. Thanks, Alex Gaynor. Backpo…

…rt of r10280 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10300 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6b937c67eae12e21d128d609fe0eceb28bb0f52a 1 parent 377cc9c
Jacob Kaplan-Moss authored March 31, 2009
14  docs/howto/deployment/index.txt
@@ -11,23 +11,17 @@ ways to easily deploy Django:
11 11
 .. toctree::
12 12
    :maxdepth: 1
13 13
    
  14
+   modwsgi
14 15
    modpython
15 16
    fastcgi
16 17
    
17  
-:ref:`Deploying under mod_python <howto-deployment-modpython>` is the
18  
-recommended deployment method; start there if you're not sure which path you'd
19  
-like to go down.
  18
+If you're new to deploying Django and/or Python, we'd recommend you try
  19
+:ref:`mod_wsgi <howto-deployment-modwsgi>` first. In most cases it'll be the easiest,
  20
+fastest, and most stable deployment choice.
20 21
 
21 22
 .. seealso::
22 23
 
23 24
     * `Chapter 20 of The Django Book`_ discusses deployment and especially
24 25
       scaling in more detail.
25 26
       
26  
-    * `mod_wsgi`_ is a newcomer to the Python deployment world, but it's rapidly
27  
-      gaining traction. Currently there's a few hoops you have to jump through to
28  
-      `use mod_wsgi with Django`_, but mod_wsgi tends to get rave reviews from
29  
-      those who use it.
30  
-
31 27
 .. _chapter 20 of the django book: http://djangobook.com/en/1.0/chapter20/
32  
-.. _mod_wsgi: http://code.google.com/p/modwsgi/
33  
-.. _use mod_wsgi with Django: http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
68  docs/howto/deployment/modwsgi.txt
... ...
@@ -0,0 +1,68 @@
  1
+.. _howto-deployment-modwsgi:
  2
+
  3
+==========================================
  4
+How to use Django with Apache and mod_wsgi
  5
+==========================================
  6
+
  7
+Deploying Django with Apache_ and `mod_wsgi`_ is the recommended way to get
  8
+Django into production.
  9
+
  10
+.. _Apache: http://httpd.apache.org/
  11
+.. _mod_wsgi: http://code.google.com/p/modwsgi/
  12
+
  13
+mod_wsgi is an Apache module which can be used to host any Python application
  14
+which supports the `Python WSGI interface`_, including Django. Django will work
  15
+with any version of Apache which supports mod_wsgi.
  16
+
  17
+.. _python wsgi interface: http://www.python.org/dev/peps/pep-0333/
  18
+
  19
+The `official mod_wsgi documentation`_ is fantastic; it's your source for all
  20
+the details about how to use mod_wsgi. You'll probably want to start with the
  21
+`installation and configuration documentation`_.
  22
+
  23
+.. _official mod_wsgi documentation: http://code.google.com/p/modwsgi/
  24
+.. _installation and configuration documentation: http://code.google.com/p/modwsgi/wiki/InstallationInstructions
  25
+
  26
+Basic Configuration
  27
+===================
  28
+
  29
+Once you've got mod_wsgi installed and activated, edit your ``httpd.conf`` file
  30
+and add::
  31
+
  32
+    WSGIScriptAlias / /path/to/mysite/apache/django.wsgi
  33
+
  34
+The first bit aboveis the url you want to be serving your application at (``/``
  35
+indicates the root url), and the second is the location of a "WSGI file" -- see
  36
+below -- on your system, usually inside of your project. This tells Apache
  37
+to serve any request below the given URL using the WSGI application defined by that file.
  38
+
  39
+Next we'll need to actually create this WSGI application, so create the file
  40
+mentioned in the second part of ``WSGIScriptAlias`` and add::
  41
+
  42
+    import os
  43
+    import sys
  44
+
  45
+    os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
  46
+
  47
+    import django.core.handlers.wsgi
  48
+    application = django.core.handlers.wsgi.WSGIHandler()
  49
+
  50
+If your project is not on your ``PYTHONPATH`` by default you can add::
  51
+
  52
+    sys.path.append('/usr/local/django')
  53
+
  54
+just above the ``import`` line to place your project on the path. Remember to
  55
+replace 'mysite.settings' with your correct settings file.
  56
+
  57
+See the :ref:`Apache/mod_python documentation<howto-deployment-modpython>` for 
  58
+directions on serving static media, and the `mod_wsgi documentation`_ for an 
  59
+explanation of other directives and configuration options you can use.
  60
+
  61
+Details
  62
+=======
  63
+
  64
+For more details, see the `mod_wsgi documentation`_, which explains the above in
  65
+more detail, and walks through all the various options you've got when deploying
  66
+under mod_wsgi.
  67
+
  68
+.. _mod_wsgi documentation: http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

0 notes on commit 6b937c6

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