Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #9970: added mod_wsgi docs. Thanks, Alex Gaynor.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 58298fae71f59e3c2b3be40feda57f2b19690045 1 parent a68c4a8
@jacobian jacobian authored
14 docs/howto/deployment/index.txt
@@ -11,23 +11,17 @@ ways to easily deploy Django:
.. toctree::
:maxdepth: 1
+ modwsgi
-:ref:`Deploying under mod_python <howto-deployment-modpython>` is the
-recommended deployment method; start there if you're not sure which path you'd
-like to go down.
+If you're new to deploying Django and/or Python, we'd recommend you try
+:ref:`mod_wsgi <howto-deployment-modwsgi>` first. In most cases it'll be the easiest,
+fastest, and most stable deployment choice.
.. seealso::
* `Chapter 20 of The Django Book`_ discusses deployment and especially
scaling in more detail.
- * `mod_wsgi`_ is a newcomer to the Python deployment world, but it's rapidly
- gaining traction. Currently there's a few hoops you have to jump through to
- `use mod_wsgi with Django`_, but mod_wsgi tends to get rave reviews from
- those who use it.
.. _chapter 20 of the django book:
-.. _mod_wsgi:
-.. _use mod_wsgi with Django:
68 docs/howto/deployment/modwsgi.txt
@@ -0,0 +1,68 @@
+.. _howto-deployment-modwsgi:
+How to use Django with Apache and mod_wsgi
+Deploying Django with Apache_ and `mod_wsgi`_ is the recommended way to get
+Django into production.
+.. _Apache:
+.. _mod_wsgi:
+mod_wsgi is an Apache module which can be used to host any Python application
+which supports the `Python WSGI interface`_, including Django. Django will work
+with any version of Apache which supports mod_wsgi.
+.. _python wsgi interface:
+The `official mod_wsgi documentation`_ is fantastic; it's your source for all
+the details about how to use mod_wsgi. You'll probably want to start with the
+`installation and configuration documentation`_.
+.. _official mod_wsgi documentation:
+.. _installation and configuration documentation:
+Basic Configuration
+Once you've got mod_wsgi installed and activated, edit your ``httpd.conf`` file
+and add::
+ WSGIScriptAlias / /path/to/mysite/apache/django.wsgi
+The first bit aboveis the url you want to be serving your application at (``/``
+indicates the root url), and the second is the location of a "WSGI file" -- see
+below -- on your system, usually inside of your project. This tells Apache
+to serve any request below the given URL using the WSGI application defined by that file.
+Next we'll need to actually create this WSGI application, so create the file
+mentioned in the second part of ``WSGIScriptAlias`` and add::
+ import os
+ import sys
+ os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
+ import django.core.handlers.wsgi
+ application = django.core.handlers.wsgi.WSGIHandler()
+If your project is not on your ``PYTHONPATH`` by default you can add::
+ sys.path.append('/usr/local/django')
+just above the ``import`` line to place your project on the path. Remember to
+replace 'mysite.settings' with your correct settings file.
+See the :ref:`Apache/mod_python documentation<howto-deployment-modpython>` for
+directions on serving static media, and the `mod_wsgi documentation`_ for an
+explanation of other directives and configuration options you can use.
+For more details, see the `mod_wsgi documentation`_, which explains the above in
+more detail, and walks through all the various options you've got when deploying
+under mod_wsgi.
+.. _mod_wsgi documentation:
2  docs/index.txt
@@ -73,7 +73,7 @@ The development process
* **Settings:** :ref:`Overview <topics-settings>` | :ref:`Full list of settings <ref-settings>`
* ** and** :ref:`Overview <ref-django-admin>` | :ref:`Adding custom commands <howto-custom-management-commands>`
* **Testing:** :ref:`Overview <topics-testing>`
- * **Deployment:** :ref:`Overview <howto-deployment-index>` | :ref:`Apache/mod_python <howto-deployment-modpython>` | :ref:`FastCGI/SCGI/AJP <howto-deployment-fastcgi>` | :ref:`Apache authentication <howto-apache-auth>` | :ref:`Serving static files <howto-static-files>` | :ref:`Tracking code errors by e-mail <howto-error-reporting>`
+ * **Deployment:** :ref:`Overview <howto-deployment-index>` | :ref:`Apache/mod_wsgi <howto-deployment-modwsgi>` | | :ref:`Apache/mod_python <howto-deployment-modpython>` :ref:`FastCGI/SCGI/AJP <howto-deployment-fastcgi>` | :ref:`Apache authentication <howto-apache-auth>` | :ref:`Serving static files <howto-static-files>` | :ref:`Tracking code errors by e-mail <howto-error-reporting>`
Other batteries included
Please sign in to comment.
Something went wrong with that request. Please try again.