Tuesday, December 21, 2004

Web Frameworks in Python

Michelle Levesque is trying out a series of web frameworks in Python, on her blog at http://pyre.third-bit.com/pywebblog. So far she's been through Webware, Quixote and CherryPy, and she's starting on Twisted.

Her experiences have been interesting. The surprise (to me) so far was CherryPy, with which Michelle managed to dash off her test application in a couple of days, compared to a couple of weeks each for Quixote and Webware. While elapsed time isn't a good measure of anything, that's a heck of a difference.

When I've looked at CherryPy before, it was version 1, which used its own "extended" version of Python, compiled before use. Version 2 is completely different, being a normal Python library, and it looks much nicer (to me). I've been trying it out, and the developers have been very responsive over my dumb questions, which is a great sign.

Nice things that have come up in Michelle's blog:
  • Quixote's strong focus on URLs as the application API is pretty neat, although I'm still not used to this way of designing things.
  • Object relational wrappers look pretty cool. Must look into SQLObject (which was what Michelle used in the CherryPy exercise).
  • Form handling libraries are good. Widgets are even better. Quixote wins here, in Michelle's experience. In my view, anything that saves me having to sling raw HTML around is good. I'd love a "SQL resultset as a table" widget of some form - most of the web applications I'd like to write seem to involve displaying the results of chunks of SQL...
Amusingly, Michelle's initial foray into Twisted seemed almost exactly like I'd expect - lots of options, no clear "right way" of doing things, and generally hard to know where to start. But she's gone with twisted.web and Nevow, which are the two things I've used in the past, so I'll be interested in seeing her conclusions. (Michelle has also gone with Atop for persistence, which I don't know much about, as I've never bothered with persistence stuff in the past).

I love twisted, and it would be my framework of preference in itself. But I really can't get my head round Nevow, and I've never been able to work out how the pieces all fit together. It's a shame, because I feel like I'm missing out on something really cool. Maybe WSGI will help, if it lets me use twisted.web as a server, with the web development framework of my choice on top of it.

For now, though, I'm still only writing toy stuff to see how all this web stuff works. Getting basic pages running is easy enough, but the HTML and CSS fiddling required to get something that looks slick is a real pain. That's where someone could realy make a difference, writing a Python library that made laying out a web page as easy as something like wxPython or Tkinter (with packers/sizers, grid widgets, etc etc).


Anonymous Anonymous said...

Give a try to this. It may just be close to what you are looking for.

October 13, 2007 6:43 am  

Post a Comment

<< Home