Ticket #16360: 16360.3.diff

File 16360.3.diff, 51.9 KB (added by Jannis Leidel, 13 years ago)

Latest version with docs

  • django/conf/global_settings.py

    diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
    index 29c9812..18a9d38 100644
    a b X_FRAME_OPTIONS = 'SAMEORIGIN'  
    404404
    405405USE_X_FORWARDED_HOST = False
    406406
     407# The import name of the WSGI application. If this is `None` the default
     408# 'django.core.handlers.wsgi.application' is used. Otherwise this shall
     409# point to an actual WSGI application.
     410WSGI_APPLICATION = None
     411
    407412##############
    408413# MIDDLEWARE #
    409414##############
  • django/conf/project_template/settings.py

    diff --git a/django/conf/project_template/settings.py b/django/conf/project_template/settings.py
    index b92c116..9eb91f7 100644
    a b MIDDLEWARE_CLASSES = (  
    9999
    100100ROOT_URLCONF = '{{ project_name }}.urls'
    101101
     102# The WSGI application used by Django's runserver etc.
     103WSGI_APPLICATION = '{{ project_name }}.wsgi.application'
     104
    102105TEMPLATE_DIRS = (
    103106    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    104107    # Always use forward slashes, even on Windows.
  • new file django/conf/project_template/wsgi.py

    diff --git a/django/conf/project_template/wsgi.py b/django/conf/project_template/wsgi.py
    new file mode 100644
    index 0000000..7e37f60
    - +  
     1"""
     2WSGI config for {{ project_name }} project.
     3
     4This module contains the actual WSGI application to be used by Django's
     5development server and the production environment as the global variable
     6named ``application`` and is enabled by setting the ``WSGI_APPLICATION``
     7setting to '{{ project_name }}.wsgi.application'.
     8
     9Of course usually you would have an actual Django WSGI application here,
     10but it also might make sense to replace the whole Django WSGI application
     11with a custom one that later delegates to the Django one (for instance if
     12you want to combine a Django application with an application of another
     13framework).
     14"""
     15from django.core.management import setup_settings
     16
     17settings = setup_settings(__name__)
     18
     19# The application object is used by the development server
     20# as well as a WSGI server configured to use this file.
     21from django.core.handlers.wsgi import application
     22
     23# Apply other WSGI middlewares here.
     24# from helloworld.wsgi import HelloWorldApplication
     25# application = HelloWorldApplication(application)
  • django/contrib/staticfiles/handlers.py

    diff --git a/django/contrib/staticfiles/handlers.py b/django/contrib/staticfiles/handlers.py
    index 962b835..d9f6833 100644
    a b class StaticFilesHandler(WSGIHandler):  
    1212    WSGI middleware that intercepts calls to the static files directory, as
    1313    defined by the STATIC_URL setting, and serves those files.
    1414    """
    15     def __init__(self, application, base_dir=None):
     15    def __init__(self, application, base_dir=None, enabled=True):
     16        # If not enabled this directly proxies to the given application.
     17        self.enabled = enabled
    1618        self.application = application
    1719        if base_dir:
    1820            self.base_dir = base_dir
    class StaticFilesHandler(WSGIHandler):  
    6365        return super(StaticFilesHandler, self).get_response(request)
    6466
    6567    def __call__(self, environ, start_response):
    66         if not self._should_handle(environ['PATH_INFO']):
    67             return self.application(environ, start_response)
    68         return super(StaticFilesHandler, self).__call__(environ, start_response)
     68        if self.enabled and self._should_handle(environ['PATH_INFO']):
     69            return super(StaticFilesHandler, self).__call__(environ, start_response)
     70        return self.application(environ, start_response)
  • django/contrib/staticfiles/management/commands/runserver.py

    diff --git a/django/contrib/staticfiles/management/commands/runserver.py b/django/contrib/staticfiles/management/commands/runserver.py
    index c6e56d2..d4e332c 100644
    a b class Command(BaseRunserverCommand):  
    2121        handler = super(Command, self).get_handler(*args, **options)
    2222        use_static_handler = options.get('use_static_handler', True)
    2323        insecure_serving = options.get('insecure_serving', False)
    24         if (settings.DEBUG and use_static_handler or
    25                 (use_static_handler and insecure_serving)):
    26             handler = StaticFilesHandler(handler)
    27         return handler
     24        enabled = use_static_handler and (settings.DEBUG or insecure_serving)
     25        return StaticFilesHandler(handler, enabled=enabled)
  • django/core/handlers/base.py

    diff --git a/django/core/handlers/base.py b/django/core/handlers/base.py
    index b7c0ff8..3606e18 100644
    a b def get_script_name(environ):  
    242242    Returns the equivalent of the HTTP request's SCRIPT_NAME environment
    243243    variable. If Apache mod_rewrite has been used, returns what would have been
    244244    the script name prior to any rewriting (so it's the script name as seen
    245     from the client's perspective), unless FORCE_SCRIPT_NAME is set (to
    246     anything).
     245    from the client's perspective), unless the FORCE_SCRIPT_NAME setting is
     246    set (to anything).
    247247    """
    248248    from django.conf import settings
    249249    if settings.FORCE_SCRIPT_NAME is not None:
  • django/core/handlers/wsgi.py

    diff --git a/django/core/handlers/wsgi.py b/django/core/handlers/wsgi.py
    index a816cad..5d58102 100644
    a b  
     1from __future__ import with_statement
    12import sys
    23from threading import Lock
    34try:
    except ImportError:  
    78
    89from django import http
    910from django.core import signals
     11from django.core.exceptions import ImproperlyConfigured
    1012from django.core.handlers import base
    1113from django.core.urlresolvers import set_script_prefix
    1214from django.utils import datastructures
    1315from django.utils.encoding import force_unicode, iri_to_uri
     16from django.utils.importlib import import_module
    1417from django.utils.log import getLogger
    1518
    1619logger = getLogger('django.request')
    class LimitedStream(object):  
    124127        self.buffer = sio.read()
    125128        return line
    126129
     130
    127131class WSGIRequest(http.HttpRequest):
    128132    def __init__(self, environ):
    129133        script_name = base.get_script_name(environ)
    class WSGIRequest(http.HttpRequest):  
    202206    FILES = property(_get_files)
    203207    REQUEST = property(_get_request)
    204208
     209
    205210class WSGIHandler(base.BaseHandler):
    206211    initLock = Lock()
    207212    request_class = WSGIRequest
    208213
    209214    def __call__(self, environ, start_response):
    210         from django.conf import settings
    211 
    212215        # Set up middleware if needed. We couldn't do this earlier, because
    213216        # settings weren't available.
    214217        if self._request_middleware is None:
    class WSGIHandler(base.BaseHandler):  
    254257        start_response(status, response_headers)
    255258        return response
    256259
     260application = WSGIHandler()
     261
     262
     263class DjangoWSGIApplication(object):
     264    """
     265    Implements a proxy to the actual WSGI application as configured
     266    by the user in settings.WSGI_APPLICATION which will usually be the
     267    `application`, optionally with middlewares applied.
     268    """
     269    def __init__(self):
     270        self._instance = None
     271        self._instance_lock = Lock()
     272
     273    def _load_application(self):
     274        from django.conf import settings
     275        app_path = getattr(settings, 'WSGI_APPLICATION')
     276        if app_path is None:
     277            return application
     278        try:
     279            module_name, attr = app_path.rsplit('.', 1)
     280            return getattr(import_module(module_name), attr)
     281        except (ImportError, AttributeError), e:
     282            raise ImproperlyConfigured("WSGI application '%s' could not "
     283                                       "be loaded: %s" % (app_path, e))
     284
     285    def __call__(self, environ, start_response):
     286        # Non-atomic check, avoids taking a lock at each call of this method
     287        if self._instance is None:
     288            with self._instance_lock:
     289                # Atomic check, prevents concurrent initialization of self._instance
     290                if self._instance is None:
     291                    self._instance = self._load_application()
     292        return self._instance(environ, start_response)
     293
     294# the proxy used in deployment
     295django_application = DjangoWSGIApplication()
  • django/core/management/__init__.py

    diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py
    index ea494c7..9ee35d3 100644
    a b def setup_environ(settings_mod, original_settings_path=None):  
    392392    # way. For example, if this file (manage.py) lives in a directory
    393393    # "myproject", this code would add "/path/to/myproject" to sys.path.
    394394    if '__init__.py' in settings_mod.__file__:
    395         p = os.path.dirname(settings_mod.__file__)
     395        path = os.path.dirname(settings_mod.__file__)
    396396    else:
    397         p = settings_mod.__file__
    398     project_directory, settings_filename = os.path.split(p)
     397        path = settings_mod.__file__
     398    project_directory, settings_filename = os.path.split(path)
    399399    if project_directory == os.curdir or not project_directory:
    400400        project_directory = os.getcwd()
    401401    project_name = os.path.basename(project_directory)
    def setup_environ(settings_mod, original_settings_path=None):  
    425425
    426426    return project_directory
    427427
     428
     429def setup_settings(path):
     430    """
     431    Configures the settings first by looking at the environment variable
     432    DJANGO_SETTINGS_MODULE or if that fail tries to find it with the
     433    given module path.
     434
     435    Example:
     436
     437    from django.core.management import setup_settings
     438
     439    setup_settings(__name__)
     440    setup_settings('wsgi')
     441    setup_settings('mysite.wsgi')
     442    """
     443    try:
     444        # Check if DJANGO_SETTINGS_MODULE is already given
     445        settings_module = os.environ['DJANGO_SETTINGS_MODULE']
     446        if not settings_module:
     447            raise KeyError
     448        settings = import_module(settings_module)
     449    except KeyError:
     450        # Or try importing the settings module two levels up,
     451        # so if name is 'mysite.wsgi', it'll try 'mysite.settings'
     452        try:
     453            settings = import_module('settings', path)
     454        except ImportError:
     455            # two levels up because name contains the submodule
     456            settings = import_module('..settings', path)
     457    setup_environ(settings)
     458
     459    # Return the settings module
     460    from django.conf import settings
     461    return settings
     462
     463
    428464def execute_from_command_line(argv=None):
    429465    """
    430466    A simple method that runs a ManagementUtility.
  • django/core/management/commands/runserver.py

    diff --git a/django/core/management/commands/runserver.py b/django/core/management/commands/runserver.py
    index 2e693e7..c84bf30 100644
    a b import sys  
    55import socket
    66
    77from django.core.management.base import BaseCommand, CommandError
    8 from django.core.handlers.wsgi import WSGIHandler
     8from django.core.handlers.wsgi import django_application
    99from django.core.servers.basehttp import AdminMediaHandler, run, WSGIServerException
    1010from django.utils import autoreload
    1111
    class BaseRunserverCommand(BaseCommand):  
    3737        """
    3838        Returns the default WSGI handler for the runner.
    3939        """
    40         return WSGIHandler()
     40        return django_application
    4141
    4242    def handle(self, addrport='', *args, **options):
    4343        self.use_ipv6 = options.get('use_ipv6')
  • django/core/servers/fastcgi.py

    diff --git a/django/core/servers/fastcgi.py b/django/core/servers/fastcgi.py
    index 9f80d2b..442df44 100644
    a b def runfastcgi(argset=[], **kwargs):  
    139139        return False
    140140
    141141    # Prep up and go
    142     from django.core.handlers.wsgi import WSGIHandler
     142    from django.core.handlers.wsgi import django_application
    143143
    144144    if options["host"] and options["port"] and not options["socket"]:
    145145        wsgi_opts['bindAddress'] = (options["host"], int(options["port"]))
    def runfastcgi(argset=[], **kwargs):  
    178178        fp.write("%d\n" % os.getpid())
    179179        fp.close()
    180180
    181     WSGIServer(WSGIHandler(), **wsgi_opts).run()
     181    WSGIServer(django_application, **wsgi_opts).run()
    182182
    183183if __name__ == '__main__':
    184184    runfastcgi(sys.argv[1:])
  • docs/howto/deployment/fastcgi.txt

    diff --git a/docs/howto/deployment/fastcgi.txt b/docs/howto/deployment/fastcgi.txt
    index 1f769cb..b4a0c4f 100644
    a b How to use Django with FastCGI, SCGI, or AJP  
    55.. highlight:: bash
    66
    77Although the current preferred setup for running Django is :doc:`Apache with
    8 mod_wsgi </howto/deployment/modwsgi>`, many people use shared hosting, on
     8mod_wsgi </howto/deployment/wsgi/modwsgi>`, many people use shared hosting, on
    99which protocols such as FastCGI, SCGI or AJP are the only viable options. In
    1010some setups, these protocols may provide better performance than mod_wsgi_.
    1111
  • docs/howto/deployment/index.txt

    diff --git a/docs/howto/deployment/index.txt b/docs/howto/deployment/index.txt
    index fdfce3e..113f606 100644
    a b ways to easily deploy Django:  
    99.. toctree::
    1010   :maxdepth: 1
    1111
    12    modwsgi
    13    uwsgi
     12   wsgi/index
    1413   fastcgi
    1514   mod_python (deprecated) <modpython>
    1615
    1716If you're new to deploying Django and/or Python, we'd recommend you try
    18 :doc:`mod_wsgi </howto/deployment/modwsgi>` first. In most cases it'll be
     17:doc:`mod_wsgi </howto/deployment/wsgi/modwsgi>` first. In most cases it'll be
    1918the easiest, fastest, and most stable deployment choice.
    2019
    2120.. seealso::
  • docs/howto/deployment/modpython.txt

    diff --git a/docs/howto/deployment/modpython.txt b/docs/howto/deployment/modpython.txt
    index f5030e9..0d9edd3 100644
    a b How to use Django with Apache and mod_python  
    77    Support for mod_python has been deprecated, and will be removed in
    88    Django 1.5. If you are configuring a new deployment, you are
    99    strongly encouraged to consider using :doc:`mod_wsgi
    10     </howto/deployment/modwsgi>` or any of the other :doc:`supported
     10    </howto/deployment/wsgi/modwsgi>` or any of the other :doc:`supported
    1111    backends </howto/deployment/index>`.
    1212
    1313.. highlight:: apache
    1414
    1515The `mod_python`_ module for Apache_ can be used to deploy Django to a
    1616production server, although it has been mostly superseded by the simpler
    17 :doc:`mod_wsgi deployment option </howto/deployment/modwsgi>`.
     17:doc:`mod_wsgi deployment option </howto/deployment/wsgi/modwsgi>`.
    1818
    1919mod_python is similar to (and inspired by) `mod_perl`_ : It embeds Python within
    2020Apache and loads Python code into memory when the server starts. Code stays in
  • deleted file docs/howto/deployment/modwsgi.txt

    diff --git a/docs/howto/deployment/modwsgi.txt b/docs/howto/deployment/modwsgi.txt
    deleted file mode 100644
    index d268334..0000000
    + -  
    1 ==========================================
    2 How to use Django with Apache and mod_wsgi
    3 ==========================================
    4 
    5 Deploying Django with Apache_ and `mod_wsgi`_ is the recommended way to get
    6 Django into production.
    7 
    8 .. _Apache: http://httpd.apache.org/
    9 .. _mod_wsgi: http://code.google.com/p/modwsgi/
    10 
    11 mod_wsgi is an Apache module which can be used to host any Python application
    12 which supports the Python WSGI interface described in :pep:`3333`, including
    13 Django. Django will work with any version of Apache which supports mod_wsgi.
    14 
    15 The `official mod_wsgi documentation`_ is fantastic; it's your source for all
    16 the details about how to use mod_wsgi. You'll probably want to start with the
    17 `installation and configuration documentation`_.
    18 
    19 .. _official mod_wsgi documentation: http://code.google.com/p/modwsgi/
    20 .. _installation and configuration documentation: http://code.google.com/p/modwsgi/wiki/InstallationInstructions
    21 
    22 Basic configuration
    23 ===================
    24 
    25 Once you've got mod_wsgi installed and activated, edit your ``httpd.conf`` file
    26 and add::
    27 
    28     WSGIScriptAlias / /path/to/mysite/apache/django.wsgi
    29 
    30 The first bit above is the url you want to be serving your application at (``/``
    31 indicates the root url), and the second is the location of a "WSGI file" -- see
    32 below -- on your system, usually inside of your project. This tells Apache
    33 to serve any request below the given URL using the WSGI application defined by that file.
    34 
    35 Next we'll need to actually create this WSGI application, so create the file
    36 mentioned in the second part of ``WSGIScriptAlias`` and add::
    37 
    38     import os
    39     import sys
    40 
    41     os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
    42 
    43     import django.core.handlers.wsgi
    44     application = django.core.handlers.wsgi.WSGIHandler()
    45 
    46 If your project is not on your ``PYTHONPATH`` by default you can add::
    47 
    48     path = '/path/to/mysite'
    49     if path not in sys.path:
    50         sys.path.append(path)
    51 
    52 just below the ``import sys`` line to place your project on the path. Remember to
    53 replace 'mysite.settings' with your correct settings file, and '/path/to/mysite'
    54 with your own project's location.
    55 
    56 .. _serving-files:
    57 
    58 Serving files
    59 =============
    60 
    61 Django doesn't serve files itself; it leaves that job to whichever Web
    62 server you choose.
    63 
    64 We recommend using a separate Web server -- i.e., one that's not also running
    65 Django -- for serving media. Here are some good choices:
    66 
    67     * lighttpd_
    68     * Nginx_
    69     * TUX_
    70     * A stripped-down version of Apache_
    71     * Cherokee_
    72 
    73 If, however, you have no option but to serve media files on the same Apache
    74 ``VirtualHost`` as Django, you can set up Apache to serve some URLs as
    75 static media, and others using the mod_wsgi interface to Django.
    76 
    77 This example sets up Django at the site root, but explicitly serves
    78 ``robots.txt``, ``favicon.ico``, any CSS file, and anything in the
    79 ``/static/`` and ``/media/`` URL space as a static file. All other URLs
    80 will be served using mod_wsgi::
    81 
    82     Alias /robots.txt /usr/local/wsgi/static/robots.txt
    83     Alias /favicon.ico /usr/local/wsgi/static/favicon.ico
    84 
    85     AliasMatch ^/([^/]*\.css) /usr/local/wsgi/static/styles/$1
    86 
    87     Alias /media/ /usr/local/wsgi/media/
    88     Alias /static/ /usr/local/wsgi/static/
    89 
    90     <Directory /usr/local/wsgi/static>
    91     Order deny,allow
    92     Allow from all
    93     </Directory>
    94 
    95     <Directory /usr/local/wsgi/media>
    96     Order deny,allow
    97     Allow from all
    98     </Directory>
    99 
    100     WSGIScriptAlias / /usr/local/wsgi/scripts/django.wsgi
    101 
    102     <Directory /usr/local/wsgi/scripts>
    103     Order allow,deny
    104     Allow from all
    105     </Directory>
    106 
    107 .. _lighttpd: http://www.lighttpd.net/
    108 .. _Nginx: http://wiki.nginx.org/Main
    109 .. _TUX: http://en.wikipedia.org/wiki/TUX_web_server
    110 .. _Apache: http://httpd.apache.org/
    111 .. _Cherokee: http://www.cherokee-project.com/
    112 
    113 .. More details on configuring a mod_wsgi site to serve static files can be found
    114 .. in the mod_wsgi documentation on `hosting static files`_.
    115 
    116 .. _hosting static files: http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#Hosting_Of_Static_Files
    117 
    118 .. _serving-the-admin-files:
    119 
    120 Serving the admin files
    121 =======================
    122 
    123 Note that the Django development server automagically serves the static files
    124 of the admin app, but this is not the case when you use any other server
    125 arrangement. You're responsible for setting up Apache, or whichever media
    126 server you're using, to serve the admin files.
    127 
    128 The admin files live in (:file:`django/contrib/admin/static/admin`) of the
    129 Django distribution.
    130 
    131 We **strongly** recommend using :mod:`django.contrib.staticfiles` to handle
    132 the admin files, but here are two other approaches:
    133 
    134     1. Create a symbolic link to the admin static files from within your
    135        document root.
    136 
    137     2. Or, copy the admin static files so that they live within your Apache
    138        document root.
    139 
    140 Details
    141 =======
    142 
    143 For more details, see the `mod_wsgi documentation on Django integration`_,
    144 which explains the above in more detail, and walks through all the various
    145 options you've got when deploying under mod_wsgi.
    146 
    147 .. _mod_wsgi documentation on Django integration: http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
  • deleted file docs/howto/deployment/uwsgi.txt

    diff --git a/docs/howto/deployment/uwsgi.txt b/docs/howto/deployment/uwsgi.txt
    deleted file mode 100644
    index 11cb51c..0000000
    + -  
    1 ============================
    2 How to use Django with uWSGI
    3 ============================
    4 
    5 .. highlight:: bash
    6 
    7 uWSGI_ is a fast, self-healing and developer/sysadmin-friendly application
    8 container server coded in pure C.
    9 
    10 It also provides a fast `caching framework`_ but its documentation is not the
    11 purpose of this document.
    12 
    13 .. _uWSGI: http://projects.unbit.it/uwsgi/
    14 .. _caching framework: http://projects.unbit.it/uwsgi/wiki/CachingFramework
    15 
    16 
    17 Prerequisite: uWSGI
    18 ===================
    19 
    20 The wiki describes several `installation procedures`_. Using pip, the python
    21 package manager, installing any uWSGI version can be done with one command
    22 line. For example::
    23 
    24     # install current stable version
    25     pip install uwsgi
    26 
    27     # or install LTS (long term support)
    28     pip install http://projects.unbit.it/downloads/uwsgi-lts.tar.gz
    29 
    30 .. _installation procedures: http://projects0.unbit.it/uwsgi/wiki/Install
    31 
    32 Prerequisite: general concept
    33 =============================
    34 
    35 uWSGI model
    36 -----------
    37 
    38 uWSGI operates on a client-server model. Your Web server (ie. nginx, Apache)
    39 communicates with a django-uwsgi "worker" process to serve dynamic contents.
    40 The Web server can communicate with the uWSGI process either:
    41 
    42 * directly by the uWSGI protocol through a socket created by uWSGI,
    43 * or by proxying HTTP requests to the minimalist HTTP server built in uWSGI.
    44 
    45 In the first case: the Web server can do uWSGI protocol (often with a
    46 module). It can then use either a Unix domain socket (a "named pipe" on Win32
    47 systems), or it can use a TCP socket. What you choose is a matterr of
    48 preference. Usually, a TCP socket is easier because connecting to a port
    49 doesn't require special permissions.
    50 
    51 In the second case, the Web server doesn't need to do uWSGI protocol. It just
    52 needs to be able to proxy HTTP requests to the HTTP server built-in uWSGI.
    53 The procedure is the same than proxying any HTTP server. Note that the Web
    54 server is a "reverse proxy" in this case.
    55 
    56 Configuring the uWSGI server
    57 ----------------------------
    58 
    59 In any case, when you set up your Web server, you'll just need to point its
    60 uwsgi or proxy module to the host/port or socket you specified when starting
    61 the uWSGI server.
    62 
    63 .. admonition:: Choosing the socket
    64 
    65     The easiest is to set the socket to a high level (>49152) local port like
    66     127.0.0.1:49152. If the socket is a file, the system administrator must
    67     ensure that the Web server process has read, write and execute privileges
    68     on that file.
    69 
    70 uWSGI is highly configurable and thus there are many ways to start the
    71 process. For example, uwsgi version 0.9.6.8 provides a hundred switches.
    72 This guide demonstrates the most important of them, but does not intent to
    73 substitute the official manual and online documentation.
    74 
    75 uWSGI supports configuration through:
    76 
    77 * environment variables
    78 * command line switches
    79 * ldap
    80 * ini files
    81 * xml files
    82 * yaml files
    83 
    84 Managing the uWSGI server
    85 -------------------------
    86 
    87 The system administrator controls the worker process pool by sending signals
    88 to the master process. For example, the unix kill command sends such signals.
    89 uWSGI can write the master process id to a "pidfile". A "pidfile" is a plain
    90 text file containing just a process id.
    91 
    92 Starting the server
    93 -------------------
    94 
    95 Starting an uWSGI server is the role of the system administrator, like
    96 starting the Web server. It is *not* the role of the Web server to start the
    97 uWSGI server. This means:
    98 
    99 * the uWSGI server can be restarted or reloaded independently from the Web
    100   server,
    101 * (except with Cheerokee), it is the role of the system administrator to make
    102   uWSGI to start on boot or reboot: either through tools like supervisor or
    103   daemontools, either directly at init level in a file like /etc/rc.local or
    104   /etc/conf.d/local
    105 
    106 Managing uWSGI
    107 ==============
    108 
    109 Starting the server
    110 -------------------
    111 
    112 Example command line for a Web server that understand the uWSGI protocol::
    113 
    114     uwsgi --chdir=/path/to/your/project
    115         --module='django.core.handlers.wsgi:WSGIHandler()' \
    116         --env DJANGO_SETTINGS_MODULE=settings \
    117         --master --pidfile=/tmp/project-master.pid \
    118         --socket=127.0.0.1:49152 \      # can also be a file
    119         --processes=5 \                 # number of worker processes
    120         --uid=1000 --gid=2000 \         # if root, uwsgi can drop privileges
    121         --harakiri=20 \                 # respawn processes taking more than 20 seconds
    122         --limit-as=128 \                # limit the project to 128 Megabytes
    123         --max-requests=5000 \           # respawn processes after serving 5000 requests
    124         --vacuum \                      # clear environment on exit
    125         --home=/path/to/virtual/env \   # optionnal path to a virtualenv
    126         --daemonize=/var/log/uwsgi/yourproject.log      # background the process
    127 
    128 Django specific options are:
    129 
    130 * ``chdir``: should be the path to your project
    131 * ``module``: uwsgi module to use
    132 * ``pythonpath``: optional path to your project virtualenv
    133 * ``env``: should contain at least ``DJANGO_SETTINGS_MODULE``
    134 
    135 Example ini configuration file::
    136 
    137     [uwsgi]
    138     chdir=/path/to/your/project
    139     master=True
    140     pidfile=/tmp/project-master.pid
    141     vacuum=True
    142     max-requests=5000
    143     deamonize=/var/log/uwsgi/yourproject.log
    144 
    145 Example ini configuration file usage::
    146 
    147     uwsgi --ini uwsgi.ini
    148 
    149 Read more `uWSGI configuration examples
    150 <http://projects.unbit.it/uwsgi/wiki/Example>`_.
    151 
    152 .. admonition:: Massive application hosting
    153 
    154     `uWSGI emperor <http://projects.unbit.it/uwsgi/wiki/Emperor>`_ is a special
    155     uWSGI process that can manage many master processes at once.
    156 
    157 Reloading the daemon
    158 --------------------
    159 
    160 As mentioned above, the uWSGI master process is one of the core component of
    161 the uWSGI stack. The signal to brutally reload all the workers and the master
    162 process is SIGTERM. Example command to brutally reload the uWSGI processes::
    163 
    164     kill -TERM `cat /tmp/project-master.pid`
    165 
    166 Patching the daemon
    167 -------------------
    168 
    169 One of the great advantages of uWSGI is its ability to gradually restart each
    170 worker without loosing any request.
    171 
    172 For example, uWSGI can be signaled that worker should reload the code after
    173 handling their current request (if any) from bash::
    174 
    175     # using kill to send the signal
    176     kill -HUP `cat /tmp/project-master.pid`
    177 
    178     # if uwsgi was started with --touch-reload=/tmp/somefile
    179     touch /tmp/somefile
    180 
    181 Or from Python::
    182 
    183     uwsgi.reload()
    184 
    185 Stopping the daemon
    186 -------------------
    187 
    188 If you have the process running in the foreground, it's easy enough to stop it:
    189 Simply hitting ``Ctrl-C`` will stop and quit the uWSGI server. However, when
    190 you're dealing with background processes, you'll need to resort to the Unix
    191 ``kill`` command.
    192 
    193 The ``kill`` is used to send a signal to the uWSGI master process. The
    194 `uWSGI signals are documented online
    195 <http://projects.unbit.it/uwsgi/wiki/uWSGISignals>`_. Example command to
    196 completely stop the uWSGI stack::
    197 
    198     kill -INT `cat /tmp/project-master.pid`
    199 
    200 HTTP server configuration
    201 =========================
    202 
    203 Nginx setup
    204 -----------
    205 
    206 Nginx provides the `uwsgi module <http://wiki.nginx.org/HttpUwsgiModule>`_ by
    207 default since nginx 0.8.40. Configuring Nginx to use an uWSGI server is as
    208 simple as setting it up to proxy requests::
    209 
    210     location / {
    211         uwsgi_pass 127.0.0.1:49152;
    212         # in case of a socket file:
    213         # uwsgi_pass unix:/tmp/yourproject.sock;
    214     }
    215 
    216 Note that default uwsgi parameters should be included somewhere in your Nginx
    217 configuration. For example::
    218 
    219     http {
    220         include       uwsgi_params;
    221         # [...] normal nginx configuration here
    222     }
    223 
    224 Cherokee setup
    225 --------------
    226 
    227 Cherokee setup is documented in the `official Cherokee uWSGI documentation
    228 <http://www.cherokee-project.com/doc/cookbook_uwsgi.html>`_.
    229 
    230 Lighttpd setup
    231 --------------
    232 
    233 `Lighttpd uwsgi module <http://projects.unbit.it/uwsgi/wiki/RunOnLighttpd>`_ is
    234 still experimental.
    235 
    236 Troubleshooting
    237 ===============
    238 
    239 As usual, the first things to do is to check the logs. This implies:
    240 
    241 * the web server log, which will indicate if it couldn't connect to the uWSGI
    242   process,
    243 * the uWSGI log, which will indicate if an exception was thrown.
    244 
    245 Typical gotchas:
    246 
    247 * If the socket is a file, the Web server process should have read, write and
    248   execute permissions on the socket file. The ``--chmod-socket`` option can do
    249   it.
    250 * In some cases, for instance if uWSGI was started without ``--vacuum`` or
    251   killed with ``SIGKILL``, it won't remove the socket and pidfile when it is
    252   interrupted. It is safe to remove them manually and to start uWSGI again in
    253   that case.
    254 * uWSGI can start the process on the foreground, this will make errors easily
    255   visible to the system administrator.
  • new file docs/howto/deployment/wsgi/index.txt

    diff --git a/docs/howto/deployment/wsgi/index.txt b/docs/howto/deployment/wsgi/index.txt
    new file mode 100644
    index 0000000..a838cf6
    - +  
     1===============
     2How to use WSGI
     3===============
     4
     5Django's prefered platform of deployment is WSGI -- the "Web Server Gateway
     6Interface" standard as defined in :pep:`333` for web servers and application
     7servers that communicate with web applications.
     8
     9Specifically, you can configure how WSGI is used by Django internally (e.g.
     10by the :djadmin:`runserver` management command) and externally when deploying
     11to one of the more commonly known platforms:
     12
     13.. toctree::
     14   :maxdepth: 1
     15
     16   modwsgi
     17   uwsgi
     18
     19The ``application`` object
     20--------------------------
     21
     22One key concept of deploying with WSGI is to specify a central ``application``
     23object which the webserver uses to communicate with your code. That's why
     24it's commonly specified as an object called ``application`` in a Python
     25module usable by the server.
     26
     27Django ships such a WSGI application object in the
     28``django.core.handlers.wsgi`` module by default but offers further
     29configurability with the :setting:`WSGI_APPLICATION` setting.
     30
     31The ``WSGI_APPLICATION`` setting
     32--------------------------------
     33
     34The :setting:`WSGI_APPLICATION` setting should point to a WSGI compatible
     35application object, specified as a dotted Python import path. By default the
     36:djadmin:`startproject` command creates a file called ``wsgi.py`` in the
     37project directory and automatically sets :setting:`WSGI_APPLICATION` to
     38``<PROJECT_NAME>.wsgi``. Django will internally automatically use this
     39module's application object when serving pages with the
     40:djadmin:`development server <runserver>`.
     41
     42For example the file generated by :djadmin:`startproject` contains::
     43
     44    from django.core.management import setup_settings
     45
     46    settings = setup_settings(__name__)
     47
     48    # The application object is used by the development server
     49    # as well as a WSGI server configured to use this file.
     50    from django.core.handlers.wsgi import application
     51
     52The call to ``setup_settings`` is required to make sure the settings are
     53configured correctly before importing the WSGI handler.
     54
     55To apply `WSGI middlewares`_ you can simple wrap the application object
     56in the same file::
     57
     58    from helloworld.wsgi import HelloWorldApplication
     59    application = HelloWorldApplication(application)
     60
     61Of course usually you would have an actual Django WSGI application here,
     62but it also might make sense to replace the whole Django WSGI application
     63with a custom WSGI application that later delegates to the Django WSGI
     64application (for instance if you want to combine a Django application with
     65a WSGI application of another framework).
     66
     67In case the :setting:`WSGI_APPLICATION` setting is ``None`` Django will
     68automatically use the ``django.core.handlers.wsgi.application`` object.
     69
     70.. _`WSGI middlewares`: http://www.python.org/dev/peps/pep-0333/#middleware-components-that-play-both-sides
  • new file docs/howto/deployment/wsgi/modwsgi.txt

    diff --git a/docs/howto/deployment/wsgi/modwsgi.txt b/docs/howto/deployment/wsgi/modwsgi.txt
    new file mode 100644
    index 0000000..af286f7
    - +  
     1==========================================
     2How to use Django with Apache and mod_wsgi
     3==========================================
     4
     5Deploying Django with Apache_ and `mod_wsgi`_ is the recommended way to get
     6Django into production.
     7
     8.. _Apache: http://httpd.apache.org/
     9.. _mod_wsgi: http://code.google.com/p/modwsgi/
     10
     11mod_wsgi is an Apache module which can be used to host any Python application
     12which supports the Python WSGI interface described in :pep:`333`, including
     13Django. Django will work with any version of Apache which supports mod_wsgi.
     14
     15The `official mod_wsgi documentation`_ is fantastic; it's your source for all
     16the details about how to use mod_wsgi. You'll probably want to start with the
     17`installation and configuration documentation`_.
     18
     19.. _official mod_wsgi documentation: http://code.google.com/p/modwsgi/
     20.. _installation and configuration documentation: http://code.google.com/p/modwsgi/wiki/InstallationInstructions
     21
     22Basic configuration
     23===================
     24
     25Once you've got mod_wsgi installed and activated, edit your ``httpd.conf``
     26file and add::
     27
     28    WSGIScriptAlias / /path/to/mysite/wsgi.py
     29
     30The first bit above is the url you want to be serving your application at
     31(``/`` indicates the root url), and the second is the location of a "WSGI
     32file" -- see below -- on your system, usually inside of your project. This
     33tells Apache to serve any request below the given URL using the WSGI
     34application defined by that file.
     35
     36Next we'll need to actually create this WSGI application, so create the file
     37mentioned in the second part of ``WSGIScriptAlias`` and add::
     38
     39    import sys
     40    from django.core.management import setup_settings
     41
     42    setup_settings(__name__)
     43
     44    # The application object is used by the development server
     45    # as well as a WSGI server configured to use this file.
     46    from django.core.handlers.wsgi import application
     47
     48If your project is not on your ``PYTHONPATH`` by default you can add::
     49
     50    path = '/path/to/mysite'
     51    if path not in sys.path:
     52        sys.path.append(path)
     53
     54just below the ``import sys`` line to place your project on the path.
     55Remember to replace 'mysite.settings' with your correct settings file,
     56and ``'/path/to/mysite'`` with your own project's location.
     57
     58.. _serving-files:
     59
     60Serving files
     61=============
     62
     63Django doesn't serve files itself; it leaves that job to whichever Web
     64server you choose.
     65
     66We recommend using a separate Web server -- i.e., one that's not also running
     67Django -- for serving media. Here are some good choices:
     68
     69    * lighttpd_
     70    * Nginx_
     71    * TUX_
     72    * A stripped-down version of Apache_
     73    * Cherokee_
     74
     75If, however, you have no option but to serve media files on the same Apache
     76``VirtualHost`` as Django, you can set up Apache to serve some URLs as
     77static media, and others using the mod_wsgi interface to Django.
     78
     79This example sets up Django at the site root, but explicitly serves
     80``robots.txt``, ``favicon.ico``, any CSS file, and anything in the
     81``/static/`` and ``/media/`` URL space as a static file. All other URLs
     82will be served using mod_wsgi::
     83
     84    Alias /robots.txt /usr/local/wsgi/static/robots.txt
     85    Alias /favicon.ico /usr/local/wsgi/static/favicon.ico
     86
     87    AliasMatch ^/([^/]*\.css) /usr/local/wsgi/static/styles/$1
     88
     89    Alias /media/ /usr/local/wsgi/media/
     90    Alias /static/ /usr/local/wsgi/static/
     91
     92    <Directory /usr/local/wsgi/static>
     93    Order deny,allow
     94    Allow from all
     95    </Directory>
     96
     97    <Directory /usr/local/wsgi/media>
     98    Order deny,allow
     99    Allow from all
     100    </Directory>
     101
     102    WSGIScriptAlias / /usr/local/wsgi/scripts/django.wsgi
     103
     104    <Directory /usr/local/wsgi/scripts>
     105    Order allow,deny
     106    Allow from all
     107    </Directory>
     108
     109.. _lighttpd: http://www.lighttpd.net/
     110.. _Nginx: http://wiki.nginx.org/Main
     111.. _TUX: http://en.wikipedia.org/wiki/TUX_web_server
     112.. _Apache: http://httpd.apache.org/
     113.. _Cherokee: http://www.cherokee-project.com/
     114
     115.. More details on configuring a mod_wsgi site to serve static files can be found
     116.. in the mod_wsgi documentation on `hosting static files`_.
     117
     118.. _hosting static files: http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#Hosting_Of_Static_Files
     119
     120.. _serving-the-admin-files:
     121
     122Serving the admin files
     123=======================
     124
     125Note that the Django development server automagically serves the static files
     126of the admin app, but this is not the case when you use any other server
     127arrangement. You're responsible for setting up Apache, or whichever media
     128server you're using, to serve the admin files.
     129
     130The admin files live in (:file:`django/contrib/admin/static/admin`) of the
     131Django distribution.
     132
     133We **strongly** recommend using :mod:`django.contrib.staticfiles` to handle
     134the admin files, but here are two other approaches:
     135
     136    1. Create a symbolic link to the admin static files from within your
     137       document root.
     138
     139    2. Or, copy the admin static files so that they live within your Apache
     140       document root.
     141
     142Details
     143=======
     144
     145For more details, see the `mod_wsgi documentation on Django integration`_,
     146which explains the above in more detail, and walks through all the various
     147options you've got when deploying under mod_wsgi.
     148
     149.. _mod_wsgi documentation on Django integration: http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
  • new file docs/howto/deployment/wsgi/uwsgi.txt

    diff --git a/docs/howto/deployment/wsgi/uwsgi.txt b/docs/howto/deployment/wsgi/uwsgi.txt
    new file mode 100644
    index 0000000..d3e631e
    - +  
     1============================
     2How to use Django with uWSGI
     3============================
     4
     5.. highlight:: bash
     6
     7uWSGI_ is a fast, self-healing and developer/sysadmin-friendly application
     8container server coded in pure C.
     9
     10It also provides a fast `caching framework`_ but its documentation is not the
     11purpose of this document.
     12
     13.. _uWSGI: http://projects.unbit.it/uwsgi/
     14.. _caching framework: http://projects.unbit.it/uwsgi/wiki/CachingFramework
     15
     16
     17Prerequisite: uWSGI
     18===================
     19
     20The wiki describes several `installation procedures`_. Using pip, the python
     21package manager, installing any uWSGI version can be done with one command
     22line. For example::
     23
     24    # install current stable version
     25    pip install uwsgi
     26
     27    # or install LTS (long term support)
     28    pip install http://projects.unbit.it/downloads/uwsgi-lts.tar.gz
     29
     30.. _installation procedures: http://projects0.unbit.it/uwsgi/wiki/Install
     31
     32Prerequisite: general concept
     33=============================
     34
     35uWSGI model
     36-----------
     37
     38uWSGI operates on a client-server model. Your Web server (ie. nginx, Apache)
     39communicates with a django-uwsgi "worker" process to serve dynamic contents.
     40The Web server can communicate with the uWSGI process either:
     41
     42* directly by the uWSGI protocol through a socket created by uWSGI,
     43* or by proxying HTTP requests to the minimalist HTTP server built in uWSGI.
     44
     45In the first case: the Web server can do uWSGI protocol (often with a
     46module). It can then use either a Unix domain socket (a "named pipe" on Win32
     47systems), or it can use a TCP socket. What you choose is a matterr of
     48preference. Usually, a TCP socket is easier because connecting to a port
     49doesn't require special permissions.
     50
     51In the second case, the Web server doesn't need to do uWSGI protocol. It just
     52needs to be able to proxy HTTP requests to the HTTP server built-in uWSGI.
     53The procedure is the same than proxying any HTTP server. Note that the Web
     54server is a "reverse proxy" in this case.
     55
     56Configuring the uWSGI server
     57----------------------------
     58
     59In any case, when you set up your Web server, you'll just need to point its
     60uwsgi or proxy module to the host/port or socket you specified when starting
     61the uWSGI server.
     62
     63.. admonition:: Choosing the socket
     64
     65    The easiest is to set the socket to a high level (>49152) local port like
     66    127.0.0.1:49152. If the socket is a file, the system administrator must
     67    ensure that the Web server process has read, write and execute privileges
     68    on that file.
     69
     70uWSGI is highly configurable and thus there are many ways to start the
     71process. For example, uwsgi version 0.9.6.8 provides a hundred switches.
     72This guide demonstrates the most important of them, but does not intent to
     73substitute the official manual and online documentation.
     74
     75uWSGI supports configuration through:
     76
     77* environment variables
     78* command line switches
     79* ldap
     80* ini files
     81* xml files
     82* yaml files
     83
     84Managing the uWSGI server
     85-------------------------
     86
     87The system administrator controls the worker process pool by sending signals
     88to the master process. For example, the unix kill command sends such signals.
     89uWSGI can write the master process id to a "pidfile". A "pidfile" is a plain
     90text file containing just a process id.
     91
     92Starting the server
     93-------------------
     94
     95Starting an uWSGI server is the role of the system administrator, like
     96starting the Web server. It is *not* the role of the Web server to start the
     97uWSGI server. This means:
     98
     99* the uWSGI server can be restarted or reloaded independently from the Web
     100  server,
     101* (except with Cheerokee), it is the role of the system administrator to make
     102  uWSGI to start on boot or reboot: either through tools like supervisor or
     103  daemontools, either directly at init level in a file like /etc/rc.local or
     104  /etc/conf.d/local
     105
     106Managing uWSGI
     107==============
     108
     109Starting the server
     110-------------------
     111
     112Example command line for a Web server that understand the uWSGI protocol::
     113
     114    uwsgi --chdir=/path/to/your/project
     115        --module='wsgi:application' \
     116        --env DJANGO_SETTINGS_MODULE=settings \
     117        --master --pidfile=/tmp/project-master.pid \
     118        --socket=127.0.0.1:49152 \      # can also be a file
     119        --processes=5 \                 # number of worker processes
     120        --uid=1000 --gid=2000 \         # if root, uwsgi can drop privileges
     121        --harakiri=20 \                 # respawn processes taking more than 20 seconds
     122        --limit-as=128 \                # limit the project to 128 Megabytes
     123        --max-requests=5000 \           # respawn processes after serving 5000 requests
     124        --vacuum \                      # clear environment on exit
     125        --home=/path/to/virtual/env \   # optionnal path to a virtualenv
     126        --daemonize=/var/log/uwsgi/yourproject.log      # background the process
     127
     128Django specific options are:
     129
     130* ``chdir``: should be the path to your project
     131* ``module``: WSGI module to use, probably the ``wsgi`` module which
     132  :djadmin:`startproject` creates.
     133* ``pythonpath``: optional path to your project virtualenv
     134* ``env``: should contain at least ``DJANGO_SETTINGS_MODULE``
     135
     136Example ini configuration file::
     137
     138    [uwsgi]
     139    chdir=/path/to/your/project
     140    master=True
     141    pidfile=/tmp/project-master.pid
     142    vacuum=True
     143    max-requests=5000
     144    deamonize=/var/log/uwsgi/yourproject.log
     145
     146Example ini configuration file usage::
     147
     148    uwsgi --ini uwsgi.ini
     149
     150Read more `uWSGI configuration examples
     151<http://projects.unbit.it/uwsgi/wiki/Example>`_.
     152
     153.. admonition:: Massive application hosting
     154
     155    `uWSGI emperor <http://projects.unbit.it/uwsgi/wiki/Emperor>`_ is a special
     156    uWSGI process that can manage many master processes at once.
     157
     158Reloading the daemon
     159--------------------
     160
     161As mentioned above, the uWSGI master process is one of the core component of
     162the uWSGI stack. The signal to brutally reload all the workers and the master
     163process is SIGTERM. Example command to brutally reload the uWSGI processes::
     164
     165    kill -TERM `cat /tmp/project-master.pid`
     166
     167Patching the daemon
     168-------------------
     169
     170One of the great advantages of uWSGI is its ability to gradually restart each
     171worker without loosing any request.
     172
     173For example, uWSGI can be signaled that worker should reload the code after
     174handling their current request (if any) from bash::
     175
     176    # using kill to send the signal
     177    kill -HUP `cat /tmp/project-master.pid`
     178
     179    # if uwsgi was started with --touch-reload=/tmp/somefile
     180    touch /tmp/somefile
     181
     182Or from Python::
     183
     184    uwsgi.reload()
     185
     186Stopping the daemon
     187-------------------
     188
     189If you have the process running in the foreground, it's easy enough to stop it:
     190Simply hitting ``Ctrl-C`` will stop and quit the uWSGI server. However, when
     191you're dealing with background processes, you'll need to resort to the Unix
     192``kill`` command.
     193
     194The ``kill`` is used to send a signal to the uWSGI master process. The
     195`uWSGI signals are documented online
     196<http://projects.unbit.it/uwsgi/wiki/uWSGISignals>`_. Example command to
     197completely stop the uWSGI stack::
     198
     199    kill -INT `cat /tmp/project-master.pid`
     200
     201HTTP server configuration
     202=========================
     203
     204Nginx setup
     205-----------
     206
     207Nginx provides the `uwsgi module <http://wiki.nginx.org/HttpUwsgiModule>`_ by
     208default since nginx 0.8.40. Configuring Nginx to use an uWSGI server is as
     209simple as setting it up to proxy requests::
     210
     211    location / {
     212        uwsgi_pass 127.0.0.1:49152;
     213        # in case of a socket file:
     214        # uwsgi_pass unix:/tmp/yourproject.sock;
     215    }
     216
     217Note that default uwsgi parameters should be included somewhere in your Nginx
     218configuration. For example::
     219
     220    http {
     221        include       uwsgi_params;
     222        # [...] normal nginx configuration here
     223    }
     224
     225Cherokee setup
     226--------------
     227
     228Cherokee setup is documented in the `official Cherokee uWSGI documentation
     229<http://www.cherokee-project.com/doc/cookbook_uwsgi.html>`_.
     230
     231Lighttpd setup
     232--------------
     233
     234`Lighttpd uwsgi module <http://projects.unbit.it/uwsgi/wiki/RunOnLighttpd>`_ is
     235still experimental.
     236
     237Troubleshooting
     238===============
     239
     240As usual, the first things to do is to check the logs. This implies:
     241
     242* the web server log, which will indicate if it couldn't connect to the uWSGI
     243  process,
     244* the uWSGI log, which will indicate if an exception was thrown.
     245
     246Typical gotchas:
     247
     248* If the socket is a file, the Web server process should have read, write and
     249  execute permissions on the socket file. The ``--chmod-socket`` option can do
     250  it.
     251* In some cases, for instance if uWSGI was started without ``--vacuum`` or
     252  killed with ``SIGKILL``, it won't remove the socket and pidfile when it is
     253  interrupted. It is safe to remove them manually and to start uWSGI again in
     254  that case.
     255* uWSGI can start the process on the foreground, this will make errors easily
     256  visible to the system administrator.
  • docs/index.txt

    diff --git a/docs/index.txt b/docs/index.txt
    index 0425da4..f372bc6 100644
    a b The development process  
    154154
    155155    * **Deployment:**
    156156      :doc:`Overview <howto/deployment/index>` |
    157       :doc:`Apache/mod_wsgi <howto/deployment/modwsgi>` |
    158       :doc:`uWSGI <howto/deployment/uwsgi>` |
     157      :doc:`Apache/mod_wsgi <howto/deployment/wsgi/modwsgi>` |
     158      :doc:`uWSGI <howto/deployment/wsgi/uwsgi>` |
    159159      :doc:`Apache/mod_python (deprecated) <howto/deployment/modpython>` |
    160160      :doc:`FastCGI/SCGI/AJP <howto/deployment/fastcgi>` |
    161161      :doc:`Apache authentication <howto/apache-auth>` |
  • docs/ref/contrib/gis/deployment.txt

    diff --git a/docs/ref/contrib/gis/deployment.txt b/docs/ref/contrib/gis/deployment.txt
    index 14f803d..59003f2 100644
    a b Example::  
    5454    number of ``processes`` instead.
    5555
    5656For more information, please consult Django's
    57 :doc:`mod_wsgi documentation </howto/deployment/modwsgi>`.
     57:doc:`mod_wsgi documentation </howto/deployment/wsgi/modwsgi>`.
    5858
    5959``mod_python``
    6060--------------
    For more information, please consult Django's  
    6262.. warning::
    6363    Support for mod_python will be deprecated in a future release of Django. If
    6464    you are configuring a new deployment, you are strongly encouraged to
    65     consider using :doc:`mod_wsgi </howto/deployment/modwsgi>` or any of the
    66     other :doc:`supported backends </howto/deployment/index>`.
     65    consider using :doc:`mod_wsgi </howto/deployment/wsgi/modwsgi>` or any of
     66    the other :doc:`supported backends </howto/deployment/index>`.
    6767
    6868Example::
    6969
  • docs/ref/request-response.txt

    diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
    index e15fa50..7cbdaf4 100644
    a b Methods  
    197197    the ``HTTP_X_FORWARDED_HOST`` (if enabled in the settings) and ``HTTP_HOST``
    198198    headers (in that order). If they don't provide a value, the method
    199199    uses a combination of ``SERVER_NAME`` and ``SERVER_PORT`` as
    200     detailed in :pep:`3333`.
     200    detailed in :pep:`333`.
    201201
    202202    Example: ``"127.0.0.1:8000"``
    203203
  • docs/ref/settings.txt

    diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
    index 8c7fe8f..b96fb96 100644
    a b A boolean that specifies whether to use the X-Forwarded-Host header in  
    20952095preference to the Host header. This should only be enabled if a proxy
    20962096which sets this header is in use.
    20972097
     2098.. setting:: WSGI_APPLICATION
     2099
     2100WSGI_APPLICATION
     2101----------------
     2102
     2103.. versionadded:: 1.4
     2104
     2105Default: ``None``
     2106
     2107The full Python path of the WSGI application object to use, as created
     2108by :djadmin:`django-admin.py startproject <startproject>`.
     2109
    20982110.. setting:: YEAR_MONTH_FORMAT
    20992111
    21002112YEAR_MONTH_FORMAT
  • docs/releases/1.3-alpha-1.txt

    diff --git a/docs/releases/1.3-alpha-1.txt b/docs/releases/1.3-alpha-1.txt
    index 3229cfd..7121271 100644
    a b more flexible ``mod_wsgi`` backend.  
    303303
    304304If you are currently using the ``mod_python`` request handler, you are strongly
    305305encouraged to redeploy your Django instances using :doc:`mod_wsgi
    306 </howto/deployment/modwsgi>`.
     306</howto/deployment/wsgi/modwsgi>`.
    307307
    308308Function-based generic views
    309309~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • docs/releases/1.3.txt

    diff --git a/docs/releases/1.3.txt b/docs/releases/1.3.txt
    index 0130657..3a3c798 100644
    a b more flexible ``mod_wsgi`` backend.  
    688688
    689689If you are currently using the ``mod_python`` request handler, you
    690690should redeploy your Django projects using another request handler.
    691 :doc:`mod_wsgi </howto/deployment/modwsgi>` is the request handler
     691:doc:`mod_wsgi </howto/deployment/wsgi/modwsgi>` is the request handler
    692692recommended by the Django project, but :doc:`FastCGI
    693693</howto/deployment/fastcgi>` is also supported. Support for
    694694``mod_python`` deployment will be removed in Django 1.5.
  • docs/topics/install.txt

    diff --git a/docs/topics/install.txt b/docs/topics/install.txt
    index 70b0783..5f3ad52 100644
    a b documentation to determine which mode is right for your setup. Make  
    4848sure you have Apache installed, with the mod_wsgi module activated.
    4949Django will work with any version of Apache that supports mod_wsgi.
    5050
    51 See :doc:`How to use Django with mod_wsgi </howto/deployment/modwsgi>`
     51See :doc:`How to use Django with mod_wsgi </howto/deployment/wsgi/modwsgi>`
    5252for information on how to configure mod_wsgi once you have it
    5353installed.
    5454
    If you can't use mod_wsgi for some reason, fear not: Django supports many other  
    5656deployment options. One is :doc:`uWSGI </howto/deployment/fastcgi>`; it works
    5757very well with `nginx`_. Another is :doc:`FastCGI </howto/deployment/fastcgi>`,
    5858perfect for using Django with servers other than Apache. Additionally, Django
    59 follows the WSGI spec (:pep:`3333`), which allows it to run on a variety of
     59follows the WSGI spec (:pep:`333`), which allows it to run on a variety of
    6060server platforms. See the `server-arrangements wiki page`_ for specific
    6161installation instructions for each platform.
    6262
  • docs/topics/settings.txt

    diff --git a/docs/topics/settings.txt b/docs/topics/settings.txt
    index 61ddf8c..507b092 100644
    a b application what settings file to use. Do that with ``os.environ``::  
    7575    os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
    7676
    7777Read the :doc:`Django mod_wsgi documentation
    78 </howto/deployment/modwsgi>` for more information and other common
     78</howto/deployment/wsgi/modwsgi>` for more information and other common
    7979elements to a Django WSGI application.
    8080
    8181Default settings
Back to Top