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

Gregory (Grisha) Trubetskoy grisha at modpython.org
Wed May 12 11:15:17 EDT 2004

On Wed, 12 May 2004, Fabian Fagerholm wrote:

> These are all real directories in the file system. Now, I know how to
> map requests for / to, say, index.py by using AddHandler and
> DirectoryIndex in a .htaccess file.

If you use the publisher handler, there is no need for directoryIndex, the
publisher will default to index.py on its own.

> 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.

That's not true, /virt will map to index.py/virt (again, this is the
publisher functionality).

Or you can have a virt.py which would contain a function called "index",
which should be accessible via /virt.

BTW - you will need to use SetHandler to hide the ".py".


More information about the Mod_python mailing list