[mod_python] how do I eliminate the .py extension in url?

Graham Dumpleton grahamd at dscpl.com.au
Thu Feb 10 20:16:38 EST 2005

Jorey Bump wrote ..
> This allows the type of URLs the OP desires. The only caveat that I'm
> aware of is that you *must not* have similar names with different
> extensions (foo.py, foo.php, foo.html, foo.jpg, etc.), or there will be
> unexpected results when apache tries to guess which one to use.
> versions: apache 1.3.x, mod_python 2.7.x

Be warned that Apache 2.0 behaves a bit different to Apache 1.3.
Specifically, mod_mime, mod_index and mod_dir in Apache 1.3 will
actually look inside directories managed by a mod_python handler
and fiddle with URLs and apply stuff like DirectoryIndex whereas
in Apache 2.0 it doesn't. I feel that the Apache 2.0 behaviour is more
correct, especially if you are using SetHandler and more or less expect
to have almost total control. Your application might therefore not
work as expected on Apache 2.0.

Your caveat of having the same basename with different extensions
is a big problem for me with Vampire because of how it promotes
physical resources and having different views of those resources. It
is quite common when using Vampire to have "foo.html" and "foo.py"
where "foo.html" is a page template which is filled out by code in


More information about the Mod_python mailing list