[mod_python] Mapping a URI to pages dynamically.

PhilipJägenstedt philipj at telia.com
Tue May 20 22:02:40 EST 2003


> Sorry for not replying earlier... Here is the code, we use...
> I have removed pieces of the code which deal with other stuff.
> I hope I have not removed too many things...
> This code is due to Dustin Mitchell who setup our site
> initially.

Thank you for that information. Your code does much more than I need,
but it certainly did help me write a transhandler of my own. I have a
few questions which I hope you can answer for me:

A: Does the code have a licensed attached to it, if I decide to use any
of it at a later date? (GPL, public domain... ?)

B: As it is now (just did this 5 minutes ago) I have the following in my
httpd.conf:
<IfModule mod_python.c>
    PythonPath "sys.path + ['/home/philip/htdocs/stdb']"
    PythonTransHandler index
</IfModule>

<Directory /home/philip/htdocs/stdb>
    Options FollowSymLinks
    AddHandler python-program .py
    PythonHandler index
    PythonDebug On
    PythonAutoReload On
</Directory>

Now I've come to understand that the PythonTransHandler must not be in a
<Directory>, <File>, .htacces or the like, so I put it in the very root
of my httpd.conf. Is this the correct way to go about it? Right now I'm
serving the mod_python pages out from /stdb/, so I only want to apply
PythonTransification for that dir, which then involves checking if the
URI begins with the /stdb. Can I add something to httpd.conf to make
PythonTransHandler apply only to /stdb, or am I then trapped in already
being past the Trans phase?

Thank you for you kind help!
// Philip Jägenstedt


More information about the Mod_python mailing list