deployment.txt 3.0 KB

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