Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added 'How to use Django with mod_python' -- docs/modpython.txt

git-svn-id: http://code.djangoproject.com/svn/django/trunk@217 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 3ad2a774a7b9224c1cd4890b9d99c6871c414372 1 parent 307f3a9
Adrian Holovaty authored July 19, 2005

Showing 1 changed file with 41 additions and 0 deletions. Show diff stats Hide diff stats

  1. 41  docs/modpython.txt
41  docs/modpython.txt
... ...
@@ -0,0 +1,41 @@
  1
+=================================
  2
+How to use Django with mod_python
  3
+=================================
  4
+
  5
+Apache/mod_python currently is the preferred server setup for using Django on a
  6
+production server.
  7
+
  8
+mod_python, available at http://www.modpython.org/ , is similar to mod_perl: It
  9
+embeds Python within Apache and loads Python code into memory when the server
  10
+starts. Code stays in memory throughout the life of an Apache process, which
  11
+leads to significant performance gains over other server arrangements.
  12
+
  13
+To configure Django with mod_python, first make sure you have Apache installed,
  14
+with the mod_python module activated.
  15
+
  16
+Then edit your ``httpd.conf`` file and add the following::
  17
+
  18
+    <Location "/mysite/">
  19
+        SetHandler python-program
  20
+        PythonHandler django.core.handlers.modpython
  21
+        SetEnv DJANGO_SETTINGS_MODULE myproject.settings.main
  22
+        PythonDebug On
  23
+    </Location>
  24
+
  25
+...and replace ``myproject.settings.main`` with the path to your settings file,
  26
+in dotted-package syntax.
  27
+
  28
+Restart Apache, and any request to /mysite/ or below will be served by Django.
  29
+Note that Django's URLconfs won't trim the "/mysite/" -- they get passed the
  30
+full URL.
  31
+
  32
+Here's a template for an admin configuration::
  33
+
  34
+    <Location "/admin/">
  35
+        SetHandler python-program
  36
+        PythonHandler django.core.handlers.modpython
  37
+        SetEnv DJANGO_SETTINGS_MODULE myproject.settings.admin
  38
+        PythonDebug On
  39
+    </Location>
  40
+
  41
+The only thing different here is the ``DJANGO_SETTINGS_MODULE``.

0 notes on commit 3ad2a77

Please sign in to comment.
Something went wrong with that request. Please try again.