Getting an early start on this lab wasn't as productive as I had hoped it would be. If it was intended as a learning experience, then I have to conclude it was 100% successful because I learned a lot.
My Linux experience is primarily what I've done in CS240 and CS360... so I expected that part to be challenging. I blundered my way through it with lots of help (especially those who posted scripts and tips).
The difficulty I had getting my script to run took me by surprise. The majority of examples I found on the web regarding getting mod_python set up in httpd.conf showed using the publisher handler. None of them really explained how the publisher handler worked and I assumed it worked like a typical CGI handler. As it turns out, mod_python actually has a cgihandler that behaves like a CGI handler... the publisher handler is something different (there's also a psp handler).
The publisher handler works by mapping methods in the script to URLs. For example a script named index.py with a method named index and a method named hello would map to the URLs http://somesite.com/ & http://somesite.com/hello respectively. For a more complete treatment see the documentation here: http://www.modpython.org/live/current/doc-html/hand-pub-alg-trav.html
This is definitely a different way of looking at things, especially if you're like me and come from a folders-and-files-map-to-urls kind of background. I'm looking forward to experimenting a little more with the publisher handler, because I feel like I may only be chipping at the tip of the iceberg.
There are a few other things I'm starting to like about the publisher handler. It adds a lot of (much welcome) abstraction to getting GET and POST data, for example. If you are just using Python the 'plain old' CGI way, I'd recommend giving mod_python a try. It adds a little bit to the learning curve, but I have a feeling it's going to pay off in the end.
Thursday, September 20, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment