[mod_python] Question about mod_python configuration

Jim Gallacher jpg at jgassociates.ca
Sat Jan 20 11:10:11 EST 2007


export at hope.cz wrote:
> I am able to use mod_python with this configuration
> 
> <Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/test"> 
>         AddHandler mod_python .py
>        PythonHandler mptest 
>       PythonDebug On 
>   </Directory>
>  
> where server root is 
>  "C:/Program Files/Apache Software Foundation/Apache2.2"
> 
> 
> But now I would like to  move PythonHandler  ( here mptest) to a different place.
> I need  the PythonHandler to  be in 
> 
> C:/MyDirectory/projects/mimproject/apps/mimi/ModPythonPom/views/mod
> 
> How must change the above configuration so that I can use mod_python?

The easiest way is to use the PythonPath directive to include your 
handler in the search path. See 
http://www.modpython.org/live/current/doc-html/dir-other-pp.html

So use something like:

<Directory "C:/Program Files/Apache Software 
Foundation/Apache2.2/htdocs/test">
   PythonPath "sys.path + 
['C:/MyDirectory/projects/mimproject/apps/mimi/ModPythonPom/views/mod']"
   AddHandler mod_python .py
   PythonHandler mptest
   PythonDebug On
</Directory>

Note that the PythonPath statement above should be on one line. There 
might be line wrapping issues with this message.

Jim


More information about the Mod_python mailing list