Django

Code

Changeset 5363

Show
Ignore:
Timestamp:
05/27/07 07:45:14 (1 year ago)
Author:
mtredinnick
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/modpython.txt

    r4958 r5363  
    211211    2. Or, copy the admin media files so that they live within your Apache 
    212212       document root. 
     213 
     214Using eggs with mod_python 
     215========================== 
     216 
     217If you installed Django from a Python egg_ or are using eggs in your Django 
     218project, some extra configuration is required. Create an extra file in your 
     219project (or somewhere else) that contains something like the following:: 
     220 
     221    import os 
     222    os.environ['PYTHON_EGG_CACHE'] = '/some/directory' 
     223 
     224Here, ``/some/directory`` is a directory that the Apache webserver process can 
     225write to. It will be used as the location for any unpacking of code the eggs 
     226need to do. 
     227 
     228Then you have to tell mod_python to import this file before doing anything 
     229else. This is done using the PythonImport_ directive to mod_python. You need 
     230to ensure that you have specified the ``PythonInterpreter`` directive to 
     231mod_python as described above__ (you need to do this even if you aren't 
     232serving multiple installations in this case). Then add the ``PythonImport`` 
     233line inside the ``Location`` or ``VirtualHost`` section. For example:: 
     234 
     235    PythonInterpreter my_django 
     236    PythonImport /path/to/my/project/file.py my_django 
     237 
     238Note that you can use an absolute path here (or a normal dotted import path), 
     239as described in the `mod_python manual`_. We use an absolute path in the 
     240above example because if any Python path modifications are required to access 
     241your project, they will not have been done at the time the ``PythonImport`` 
     242line 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`_ 
    213248 
    214249Error handling 
     
    257292.. _mod_python FAQ entry: http://modpython.org/FAQ/faqw.py?req=show&file=faq02.013.htp 
    258293.. _Getting mod_python Working: http://www.dscpl.com.au/articles/modpython-001.html 
     294 
     295