[mod_python] Using SetHandler mod_python in the web root.

Nicolas Lehuen nicolas.lehuen at gmail.com
Sat Jan 29 11:02:20 EST 2005


Hi,

Your problem comes from the fact that you are using the SetHandler
directive. As soon as you use it, *all* requests are handled by
mod_python, not just the ones for .py files.

You have two options :

1) You can use the AddHandler directive :

DocumentRoot /some/path
</Directory /some/path>
               AddHandler mod_python .py
               PythonHandler index | .py
               PythonDebug On
</Directory>

This way *all* request for files ending with .py (for example, a
request for /index.py) will be handled by you index handler.

For more flexibility, you could have a look at the mod_python publisher.

2) Keep the SetHandler directive, so everything will go through
mod_python, but use the Vampire handler
(http://www.dscpl.com.au/projects/vampire/). You then have to
configure Vampire to correctly serve .xsl files.

Regards,
Nicolas

On Sat, 29 Jan 2005 23:27:39 +0800, sp3ktr <sp3ktr at gmail.com> wrote:
> Hi all!
> 
> I'm relatively new to mod_python and am having trouble using
> mod_python from the root of the web server.  My current apache2 config
> is:
> 
> DocumentRoot /some/path
> </Directory /some/path>
>                 SetHandler mod_python
>                 PythonHandler index
>                 PythonDebug On
> </Directory>
> 
> the web server has this file structure:
> 
> /
> /xsl
> /xsl/default.xsl
> /index.py
> 
> When i write out xml from index.py the link to /xsl/default.xsl
> doesn't work because all requests go through index.py now.  I'm
> wondering how to set up the handler in such a way that i can still
> access the /xsl/* files?
> 
> The reason for this is that i would like all requests to go to
> http://host/<request>  while retaining the /xsl as the main store of
> xsl files.  And also to hide the .py extension in the url.
> 
> Any help would be greatly appreciated
> 
> --
> adieu
> sp3ktr
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list