2010-03-27 04:14:53 +08:00
|
|
|
===================
|
|
|
|
Deploying GeoDjango
|
|
|
|
===================
|
|
|
|
|
|
|
|
.. warning::
|
|
|
|
|
|
|
|
GeoDjango uses the GDAL geospatial library which is
|
|
|
|
not thread safe at this time. Thus, it is *highly* recommended
|
2011-08-13 19:58:19 +08:00
|
|
|
to not use threading when deploying -- in other words, use an
|
|
|
|
appropriate configuration of Apache or the prefork method
|
2010-10-09 16:12:50 +08:00
|
|
|
when using FastCGI through another Web server.
|
2010-03-27 04:14:53 +08:00
|
|
|
|
|
|
|
Apache
|
|
|
|
======
|
2010-08-28 10:40:57 +08:00
|
|
|
In this section there are some example ``VirtualHost`` directives for
|
2010-03-27 04:14:53 +08:00
|
|
|
when deploying using either ``mod_python`` or ``mod_wsgi``. At this
|
2010-08-28 10:40:57 +08:00
|
|
|
time, we recommend ``mod_wsgi``, as it is now officially recommended
|
2010-03-27 04:14:53 +08:00
|
|
|
way to deploy Django applications with Apache. Moreover, if
|
|
|
|
``mod_python`` is used, then a prefork version of Apache must also be
|
|
|
|
used. As long as ``mod_wsgi`` is configured correctly, it does not
|
|
|
|
matter whether the version of Apache is prefork or worker.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
2011-02-15 07:18:30 +08:00
|
|
|
The ``Alias`` and ``Directory`` configurations in the examples
|
2010-08-28 10:40:57 +08:00
|
|
|
below use an example path to a system-wide installation folder of Django.
|
2010-03-27 04:14:53 +08:00
|
|
|
Substitute in an appropriate location, if necessary, as it may be
|
|
|
|
different than the path on your system.
|
|
|
|
|
|
|
|
``mod_wsgi``
|
|
|
|
------------
|
|
|
|
|
|
|
|
Example::
|
|
|
|
|
|
|
|
<VirtualHost *:80>
|
|
|
|
WSGIDaemonProcess geodjango user=geo group=geo processes=5 threads=1
|
|
|
|
WSGIProcessGroup geodjango
|
|
|
|
WSGIScriptAlias / /home/geo/geodjango/world.wsgi
|
2010-08-28 10:40:57 +08:00
|
|
|
|
2012-03-31 16:24:29 +08:00
|
|
|
Alias /media/ "/usr/lib/python2.6/site-packages/django/contrib/admin/media/"
|
|
|
|
<Directory "/usr/lib/python2.6/site-packages/django/contrib/admin/media/">
|
2010-03-27 04:14:53 +08:00
|
|
|
Order allow,deny
|
|
|
|
Options Indexes
|
|
|
|
Allow from all
|
|
|
|
IndexOptions FancyIndexing
|
|
|
|
</Directory>
|
2010-08-28 10:40:57 +08:00
|
|
|
|
2010-03-27 04:14:53 +08:00
|
|
|
</VirtualHost>
|
|
|
|
|
|
|
|
.. warning::
|
|
|
|
|
|
|
|
If the ``WSGIDaemonProcess`` attribute ``threads`` is not set to ``1``, then
|
2010-08-28 10:40:57 +08:00
|
|
|
Apache may crash when running your GeoDjango application. Increase the
|
2010-03-27 04:14:53 +08:00
|
|
|
number of ``processes`` instead.
|
|
|
|
|
|
|
|
For more information, please consult Django's
|
2011-10-22 12:30:10 +08:00
|
|
|
:doc:`mod_wsgi documentation </howto/deployment/wsgi/modwsgi>`.
|
2010-03-27 04:14:53 +08:00
|
|
|
|
|
|
|
``mod_python``
|
|
|
|
--------------
|
|
|
|
|
2010-08-28 10:40:57 +08:00
|
|
|
.. warning::
|
|
|
|
Support for mod_python will be deprecated in a future release of Django. If
|
|
|
|
you are configuring a new deployment, you are strongly encouraged to
|
2011-10-22 12:30:10 +08:00
|
|
|
consider using :doc:`mod_wsgi </howto/deployment/wsgi/modwsgi>` or any of
|
|
|
|
the other :doc:`supported servers </howto/deployment/index>`.
|
2010-08-28 10:40:57 +08:00
|
|
|
|
2010-03-27 04:14:53 +08:00
|
|
|
Example::
|
|
|
|
|
|
|
|
<VirtualHost *:80>
|
2010-08-28 10:40:57 +08:00
|
|
|
|
2010-03-27 04:14:53 +08:00
|
|
|
<Location "/">
|
|
|
|
SetHandler mod_python
|
|
|
|
PythonHandler django.core.handlers.modpython
|
|
|
|
SetEnv DJANGO_SETTINGS_MODULE world.settings
|
|
|
|
PythonDebug On
|
|
|
|
PythonPath "['/var/www/apps'] + sys.path"
|
|
|
|
</Location>
|
2010-08-28 10:40:57 +08:00
|
|
|
|
2012-03-31 16:24:29 +08:00
|
|
|
Alias /media/ "/usr/lib/python2.6/site-packages/django/contrib/admin/media/"
|
2010-03-27 04:14:53 +08:00
|
|
|
<Location "/media">
|
|
|
|
SetHandler None
|
|
|
|
</Location>
|
2010-08-28 10:40:57 +08:00
|
|
|
|
2010-03-27 04:14:53 +08:00
|
|
|
</VirtualHost>
|
|
|
|
|
|
|
|
.. warning::
|
|
|
|
|
|
|
|
When using ``mod_python`` you *must* be using a prefork version of Apache, or
|
|
|
|
else your GeoDjango application may crash Apache.
|
|
|
|
|
|
|
|
For more information, please consult Django's
|
2010-08-20 03:27:44 +08:00
|
|
|
:doc:`mod_python documentation </howto/deployment/modpython>`.
|
2010-03-27 04:14:53 +08:00
|
|
|
|
|
|
|
Lighttpd
|
|
|
|
========
|
|
|
|
|
|
|
|
FastCGI
|
|
|
|
-------
|
|
|
|
|
|
|
|
Nginx
|
|
|
|
=====
|
|
|
|
|
|
|
|
FastCGI
|
|
|
|
-------
|