Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #4150 -- Added an explanation of how to use eggs with mod_python.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5363 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b0b5023313eae66c0ed3642cff1a4abae1d7da69 1 parent a4e3581
Malcolm Tredinnick authored May 27, 2007

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

  1. 37  docs/modpython.txt
37  docs/modpython.txt
@@ -211,6 +211,41 @@ Here are two recommended approaches:
211 211
     2. Or, copy the admin media files so that they live within your Apache
212 212
        document root.
213 213
 
  214
+Using eggs with mod_python
  215
+==========================
  216
+
  217
+If you installed Django from a Python egg_ or are using eggs in your Django
  218
+project, some extra configuration is required. Create an extra file in your
  219
+project (or somewhere else) that contains something like the following::
  220
+
  221
+    import os
  222
+    os.environ['PYTHON_EGG_CACHE'] = '/some/directory'
  223
+
  224
+Here, ``/some/directory`` is a directory that the Apache webserver process can
  225
+write to. It will be used as the location for any unpacking of code the eggs
  226
+need to do.
  227
+
  228
+Then you have to tell mod_python to import this file before doing anything
  229
+else. This is done using the PythonImport_ directive to mod_python. You need
  230
+to ensure that you have specified the ``PythonInterpreter`` directive to
  231
+mod_python as described above__ (you need to do this even if you aren't
  232
+serving multiple installations in this case). Then add the ``PythonImport``
  233
+line inside the ``Location`` or ``VirtualHost`` section. For example::
  234
+
  235
+    PythonInterpreter my_django
  236
+    PythonImport /path/to/my/project/file.py my_django
  237
+
  238
+Note that you can use an absolute path here (or a normal dotted import path),
  239
+as described in the `mod_python manual`_. We use an absolute path in the
  240
+above example because if any Python path modifications are required to access
  241
+your project, they will not have been done at the time the ``PythonImport``
  242
+line is processed.
  243
+
  244
+.. _Egg: http://peak.telecommunity.com/DevCenter/PythonEggs
  245
+.. _PythonImport: http://www.modpython.org/live/current/doc-html/dir-other-pimp.html
  246
+.. _mod_python manual: PythonImport_
  247
+__ `Multiple Django installations on the same Apache`_
  248
+
214 249
 Error handling
215 250
 ==============
216 251
 
@@ -256,3 +291,5 @@ as necessary.
256 291
 .. _Expat Causing Apache Crash: http://www.dscpl.com.au/articles/modpython-006.html
257 292
 .. _mod_python FAQ entry: http://modpython.org/FAQ/faqw.py?req=show&file=faq02.013.htp
258 293
 .. _Getting mod_python Working: http://www.dscpl.com.au/articles/modpython-001.html
  294
+
  295
+

0 notes on commit b0b5023

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