[mod_python] installation config to allow different programs

Geert Jansen geert at boskant.nl
Wed Sep 19 13:35:50 EST 2001


You wrote:

> I am wondering why there is no handler distributed with mod
> python to simply
> allow something more like.
>
> <IfModule mod_python.c>
>   Alias /python/ /some/where/
>   <Location /python>
>     SetHandler python-program
>     PythonHandler mod_python.run
>   </Location>
> </IfModule>

[snip]

> http://servername/python/first gives the Hello World program
> an access to
> http://servername/python/second gives the Goodby World program
>
> Also notice the programs dont have any .py extension.

mod_python doesn't contain a handler that can do this. But it's easy to
write such a handler yourself. You can get the python script name from
request.path_info(). Use this to load it with __import__() and use hasattr()
to check for a function named handler(). Then call the function.

Greetings,
Geert
--
long long email=0X78DC806B91FCA334,i=0,j; main(){j=(email>>4*i)&15;
putchar(j+j/2+j/5-j/12+(j<13?97:-65+7*j));i/15?exit(0):++i,main();}




More information about the Mod_python mailing list