Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added some more to docs/modpython.txt

git-svn-id: http://code.djangoproject.com/svn/django/trunk@221 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1dfc375e35d44d68b84eb3ae6e7c1fd04c920eee 1 parent 21f152e
Adrian Holovaty authored July 19, 2005

Showing 1 changed file with 23 additions and 4 deletions. Show diff stats Hide diff stats

  1. 27  docs/modpython.txt
27  docs/modpython.txt
@@ -5,10 +5,11 @@ How to use Django with mod_python
5 5
 Apache/mod_python currently is the preferred setup for using Django on a
6 6
 production server.
7 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.
  8
+mod_python, available at http://www.modpython.org/ , is similar to
  9
+`mod_perl`_ : It embeds Python within Apache and loads Python code into memory
  10
+when the server starts. Code stays in memory throughout the life of an Apache
  11
+process, which leads to significant performance gains over other server
  12
+arrangements.
12 13
 
13 14
 To configure Django with mod_python, first make sure you have Apache installed,
14 15
 with the mod_python module activated.
@@ -25,10 +26,25 @@ Then edit your ``httpd.conf`` file and add the following::
25 26
 ...and replace ``myproject.settings.main`` with the path to your settings file,
26 27
 in dotted-package syntax.
27 28
 
  29
+This tells Apache: "Use mod_python for any URL at or under '/mysite/', using the
  30
+Django mod_python handler." It passes the value of ``DJANGO_SETTINGS_MODULE``
  31
+so mod_python knows which settings to use.
  32
+
  33
+Also, if you've manually altered your ``PYTHONPATH`` to put your Django project
  34
+on it, you'll need to tell mod_python::
  35
+
  36
+    PythonPath "['/path/to/project'] + sys.path"
  37
+
  38
+You can also add directives such as ``PythonAutoReload Off`` for performance.
  39
+See the `mod_python documentation`_ for a full list of options.
  40
+
28 41
 Restart Apache, and any request to /mysite/ or below will be served by Django.
29 42
 Note that Django's URLconfs won't trim the "/mysite/" -- they get passed the
30 43
 full URL.
31 44
 
  45
+When deploying Django sites on mod_python, you'll need to restart Apache each
  46
+time you make changes to your Python code.
  47
+
32 48
 Here's a template for an admin configuration::
33 49
 
34 50
     <Location "/admin/">
@@ -39,3 +55,6 @@ Here's a template for an admin configuration::
39 55
     </Location>
40 56
 
41 57
 The only thing different here is the ``DJANGO_SETTINGS_MODULE``.
  58
+
  59
+.. _mod_perl: http://perl.apache.org/
  60
+.. _mod_python documentation: http://modpython.org/live/current/doc-html/directives.html

0 notes on commit 1dfc375

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