[mod_python] How can I have sensible URLs?

Christoph Fritzsch christoph at cocon-seide.com
Wed Sep 4 16:50:24 EST 2002

Hi Peter !

>Say, I have the following scripts that form a user interface to a library
>database (say, I'm using Python over CGI for this one here)
>- http://www.mydomain.com/libdb/index.py
>- http://www.mydomain.com/libdb/input.py
I can see perfectly well that ONE big script would be a pain in the a....
And I hope I understood you alright.
But why not seperate them by putting one script in in one file and wrap it in one def:
file "input.py" :

def main():
  all the code input needs
  return 'the printout'

and call it by http://.../libdb/input/main
next file "maintainer.py":
def main():
 return 'xx'
and call it by http://.../libdb/maintainer/main

prerequisite is that the publisher is installed :-)

The only disadvantage would be the trailing /main or whatever you should call it if main 
is a reseverd word

Take care Christoph

More information about the Mod_python mailing list