top | item 181304

Frustrated with mod_python: is there any complete documentation out there?

7 points| ingenium | 18 years ago | reply

It me an hour to figure out that to not get 404 errors, you have to make the primary function called index. Now I'm trying to pass a variable in the URL and retrieve it. This is simple in PHP, and in Python I would think it would just be a dictionary.

The official documentation from mod_python is virtually useless. Even a list of classes and functions and how they work would be great.

6 comments

order
[+] micktwomey|18 years ago|reply
I think most people don't use mod_python directly, but instead use it as a means of running their web framework. So, for example, django comes with support for mod_python (http://www.djangoproject.com/documentation/modpython/).

mod_wsgi (http://code.google.com/p/modwsgi/) is rapidly becoming popular, it's an implementation of the python wsgi spec which has a plethora of toolkits and libraries available.

If you want to go low level I'd recommend mod_wsgi + a library like webob. Otherwise I recommend django on top of mod_python (or mod_wsgi).

[+] briansmith|18 years ago|reply
I can also recommend mod_wsgi in daemon mode. The developer (Graham Dumpleton) is really great about supporting it on its mailing list.
[+] ra|18 years ago|reply
+1 Great advice.
[+] simonw|18 years ago|reply
Oddly enough Django was actually originally written as an easy abstraction layer around mod_python - partly so we didn't have to work with the low-leveal mod_python constructs, but mostly because back in 2003 we weren't 100% sure mod_python would work for us, and having an abstraction layer would make it easy to move to something else if we needed to (this was before WSGI as well).
[+] thingsilearned|18 years ago|reply
Hi Josh.

Try Django? I think you'll be much happier.

[+] inklesspen|18 years ago|reply
I suggest writing a WSGI app. Then you can deploy it in a variety of ways, one of which is mod_python. Another method, as others mentioned, is mod_wsgi, and the best method in my experience is mod_proxy reverse-proxying to paste.httpserver.