[Tutor] What web framework?

Michael Langford michael.langford at rowdylabs.com
Tue Jan 29 17:46:55 CET 2008

On Jan 28, 2008 7:35 PM, Terry Carroll <carroll at tjc.com> wrote:
> It looks like the leading candidates here are Turbogears and Django.

This s a results of trying and sometimes using these frameworks over 3
years now. I sometimes thoughtfully evaluate all my options before
choosing, other times, I just pick what I can ape off of quickly as
possible then get to work. Please don't firebomb my house because I
misspoke or put down your favorite web framework. I know this is a
tender subject for some of you. I guarantee the below is factually
inaccurate in some ways. Then again, it wouldn't be written if I had
to do more research to write it.

I talk about Magic and Configuration below. Configuration is what you
do in Java frameworks, where you make 2^23 xml files to make hello
world work. Magic is what happens in Ruby on Rails, where things work
and sometimes don't work, but they do it with very little
specification required by the user. This makes it hard to tell how
something isn't working, or why it is working but slowly. Then again,
it makes all initial work fast fast fast. Which frankly, will get you
to actually finish your application a lot faster.

The new standard for python web applications is WSGI. If you write
your apps to be WSGI compliant, you can integrate them with each other
and with different webservers within minutes. Yes. Minutes. It's
really quite cool. And it's really not that hard. (Look into Paste to
get that "minutes" thing down).

This question is sort of like asking what is the best text editor.
Here is a good screencast to see one guy doing this comparison:

Here are your choices of full frameworks, what they bring, and why you
might want them:
Pylons: Infinite customizablity. Plays well with other frameworks.It's
the python analog to Ruby on Rails. If you like lots of magic (i.e.
Little configuration), you'll like this. Pylons is WSGI compliant.

Zope/Plone. The framework really is Zope, but cutting down and turning
off parts of Plone if it already does most of what you want is often
faster than writing it all yourself.  They have awesome screencasts to
get you going, and you can quickly get a GUI for free with this
system.  I think these guys are the ones who dreamt up WSGI IIRC.
These guys have lots of cross platform apps you can use for Zope and
Plone Sites: http://plone.org/about/movies
http://www.zope.org/WhatIsZope You can build anything on Zope. It is
becoming less of a ghetto (i.e. all the code is walled off in zope)
every day, especially with tools such as Repoze
http://radio.weblogs.com/0116506/2007/10/26.html#a441 Plone (and
therefore Zope) comes with an easy installer for all platforms.

Django: You can run a newspaper off this. A number of people do, as a
matter of fact, the framework came out of newspapers. If you need to
do something other than running a newspaper, this probably isn't for
you. Its a little configuration file heavy for my tastes, and the
installable apps aren't as cross platform as the Zope ones in my
experience http://www.djangoproject.com/ I feel the documentation is
light years behind zope and pylons (then again, that's because pylons
needs so little documentation). Is compliant with WSGI according to

Turbogears: Ahh Turbogears. Your tutorial screencast turned everyone
on to you, then they tried it, and it didn't work for them because
they had the wrong version of something installed or they were on a
different flavor of linux, or etc etc etc. Frankly, this has worked
sometimes for me, sometimes not. I don't like that. I like being able
to make it work no matter where I am. When it does work though, you
pop out a site pretty quickly. You also have a good mix of magic and
configuration, that way you can just get a site out there, then you
can redo it to be higher performance the night after your server melts
from being posted on a busy site like slashdot or the python tutor
archives. Appears to be on WSGI now.

Paste. This is Ian Bicking showing us how we're all inferior human
beings. http://pythonpaste.org/ It's the lightest possible weight
framework. It's so light weight, half of the above frameworks use it
internally. You should probably use this one from what you've said.

Then you can go for something I'd call a microframework:
Web.py and mod_python and cherrypy all fit that bill. These are often
tied to a given webserver, which may be just fine for you. Or you can
write a WSGI compliant app on top of one of those, then upgrade
when/if you need it. I don't see a single one that beats Paste for
what you need.

In short:
Do WSGI if you can: http://wsgi.org/wsgi/Frameworks
Pick according to your comfort level/motivation level when choosing
between Configuration and Magic
Probably use Paste(http://pythonpaste.org/), but maybe use a more
involved framework too.

Michael Langford
Phone: 404-386-0495
Consulting: http://www.RowdyLabs.com

More information about the Tutor mailing list