parts/django/docs/ref/contrib/gis/deployment.txt
changeset 69 c6bca38c1cbf
equal deleted inserted replaced
68:5ff1fc726848 69:c6bca38c1cbf
       
     1 ===================
       
     2 Deploying GeoDjango
       
     3 ===================
       
     4 
       
     5 .. warning::
       
     6 
       
     7     GeoDjango uses the GDAL geospatial library which is
       
     8     not thread safe at this time.  Thus, it is *highly* recommended
       
     9     to not use threading when deploying -- in other words, use a 
       
    10     an appropriate configuration of Apache or the prefork method
       
    11     when using FastCGI through another Web server.
       
    12 
       
    13 Apache
       
    14 ======
       
    15 In this section there are some example ``VirtualHost`` directives for 
       
    16 when deploying using either ``mod_python`` or ``mod_wsgi``.  At this
       
    17 time, we recommend ``mod_wsgi``, as it is now officially recommended 
       
    18 way to deploy Django applications with Apache.  Moreover, if
       
    19 ``mod_python`` is used, then a prefork version of Apache must also be
       
    20 used.  As long as ``mod_wsgi`` is configured correctly, it does not
       
    21 matter whether the version of Apache is prefork or worker.
       
    22 
       
    23 .. note::
       
    24 
       
    25     The ``Alias`` and ``Directory`` configurations in the the examples
       
    26     below use an example path to a system-wide installation folder of Django.  
       
    27     Substitute in an appropriate location, if necessary, as it may be
       
    28     different than the path on your system.
       
    29 
       
    30 ``mod_wsgi``
       
    31 ------------
       
    32 
       
    33 Example::
       
    34 
       
    35     <VirtualHost *:80>
       
    36       WSGIDaemonProcess geodjango user=geo group=geo processes=5 threads=1
       
    37       WSGIProcessGroup geodjango
       
    38       WSGIScriptAlias / /home/geo/geodjango/world.wsgi
       
    39   
       
    40       Alias /media/ "/usr/lib/python2.5/site-packages/django/contrib/admin/media/"
       
    41       <Directory "/usr/lib/python2.5/site-packages/django/contrib/admin/media/">
       
    42         Order allow,deny
       
    43         Options Indexes
       
    44         Allow from all
       
    45         IndexOptions FancyIndexing
       
    46       </Directory>
       
    47     
       
    48     </VirtualHost>
       
    49 
       
    50 .. warning::
       
    51 
       
    52     If the ``WSGIDaemonProcess`` attribute ``threads`` is not set to ``1``, then
       
    53     Apache may crash when running your GeoDjango application.  Increase the 
       
    54     number of ``processes`` instead.
       
    55 
       
    56 For more information, please consult Django's
       
    57 :doc:`mod_wsgi documentation </howto/deployment/modwsgi>`.
       
    58 
       
    59 ``mod_python``
       
    60 --------------
       
    61 
       
    62 Example::
       
    63 
       
    64     <VirtualHost *:80>
       
    65     
       
    66       <Location "/">
       
    67         SetHandler mod_python
       
    68         PythonHandler django.core.handlers.modpython
       
    69         SetEnv DJANGO_SETTINGS_MODULE world.settings
       
    70         PythonDebug On
       
    71         PythonPath "['/var/www/apps'] + sys.path"
       
    72       </Location>
       
    73     
       
    74       Alias /media/ "/usr/lib/python2.5/site-packages/django/contrib/admin/media/"
       
    75       <Location "/media">
       
    76         SetHandler None
       
    77       </Location>
       
    78     
       
    79     </VirtualHost>
       
    80 
       
    81 .. warning::
       
    82 
       
    83    When using ``mod_python`` you *must* be using a prefork version of Apache, or
       
    84    else your GeoDjango application may crash Apache.
       
    85 
       
    86 For more information, please consult Django's
       
    87 :doc:`mod_python documentation </howto/deployment/modpython>`.
       
    88 
       
    89 Lighttpd
       
    90 ========
       
    91 
       
    92 FastCGI
       
    93 -------
       
    94 
       
    95 Nginx
       
    96 =====
       
    97 
       
    98 FastCGI
       
    99 -------