[mod_python] How can I have sensible URLs?

Peter Bittner peter.bittner at gmx.net
Wed Sep 4 15:09:32 EST 2002


> mod_rewrite is flexible (due to the use of regexp), easy to understand,
> and incredibly powerful : it allows you to do everything you want when
> dealing with url problems. try it and you will like it.

I'm sure mod_rewrite is a good thing when all you want is really just
beautiful URLs and nothing more.

In my case I think there is some more to it. I'll try to sketch it out:
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
- http://www.mydomain.com/libdb/search.py
- http://www.mydomain.com/libdb/reports.py
- http://www.mydomain.com/libdb/maintain.py

I'm sure you can imagine that every script is doing a lot of stuff (printing
out HTML forms, handling user actions and so on). - Let's see how I would
implement this with mod_python:

- I would write one large mod_python script called "libdb.py" which contains
basically the whole code of all the above listed scripts. Each of the above
scripts I would replace by methods (handlers) like "def index():", "def
input():", "def search():", etc.
Then I've ended up with a huge, almost unmaintainable script.  :-(

Is there any way to avoid this?
Would anyone tackle this problem differently?

Any help is greatly appreciated!
Cheers, Peter

Peter Bittner
mobil: +43/(0)650/4151545
web: http://www.bittner.at.tf - http://beam.to/htmlkurs
mail: peter.bittner at gmx.net

"Free software is like free speech, not free beer" (Richard Stallman)

GMX - Die Kommunikationsplattform im Internet.

More information about the Mod_python mailing list