[mod_python] Problem with mapping URIs to filesystem/Python modules

Manfred Stienstra manfred.stienstra at dwerg.net
Wed May 12 16:57:59 EDT 2004


On Wed, 2004-05-12 at 11:20, Fabian Fagerholm wrote:
> The problem is this: when accessing /, the request maps to /index.py
> because of the DirectoryIndex directive. But if I wanted to create a
> "virtual directory" /virt, which would map to /index.py/virt (calling
> the virt function in the index.py module) then the only way is to
> actually call it by name.
> 
> How can I hide index.py in the URI?

You can let python handle all the request on a path:

SetHandler python-program
PythonHandler handler

This will call handler.py - handler(req) for every request on this path.
If you don't want to call your handler handler:

PythonHandler myhandlerfilename:myhandlerfunctionname

If you still want to serve real files from this path, just return
apache.DECLINED from your handler and apache will retry the request with
the core handler.

I hope this helps,
 Manfred




More information about the Mod_python mailing list