浏览代码

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

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10280 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Jacob Kaplan-Moss 16 年之前
父节点
当前提交
58298fae71
共有 3 个文件被更改,包括 73 次插入11 次删除
  1. 4 10
      docs/howto/deployment/index.txt
  2. 68 0
      docs/howto/deployment/modwsgi.txt
  3. 1 1
      docs/index.txt

+ 4 - 10
docs/howto/deployment/index.txt

@@ -11,23 +11,17 @@ ways to easily deploy Django:
 .. toctree::
    :maxdepth: 1
    
+   modwsgi
    modpython
    fastcgi
    
-: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: http://djangobook.com/en/1.0/chapter20/
-.. _mod_wsgi: http://code.google.com/p/modwsgi/
-.. _use mod_wsgi with Django: http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

+ 68 - 0
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: http://httpd.apache.org/
+.. _mod_wsgi: http://code.google.com/p/modwsgi/
+
+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: http://www.python.org/dev/peps/pep-0333/
+
+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: http://code.google.com/p/modwsgi/
+.. _installation and configuration documentation: http://code.google.com/p/modwsgi/wiki/InstallationInstructions
+
+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.
+
+Details
+=======
+
+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: http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

+ 1 - 1
docs/index.txt

@@ -73,7 +73,7 @@ The development process
     * **Settings:** :ref:`Overview <topics-settings>` | :ref:`Full list of settings <ref-settings>`
     * **django-admin.py and manage.py:** :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
 ========================