django vs zope vs web2py

Modulok modulok at gmail.com
Sun Apr 21 08:19:07 EDT 2013


> Hi everyone,
> few months back I decided to adopt python for my all sort of work including
> web programming...
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Pick Django or web2py. You'll be happy with either. (I have no experience with
zope.)

They're both full featured do-everything-you-ever-wanted frameworks with great
communities and lots of documentation. You can buy books on either. I'd say
web2py is a little more elegant and easier to get started with. (An admittedly
subjective claim.) Django has a little larger community and has more third
party stuff.

If you just need to "get it done" and don't care about how it happens, they're
both excellent. You'll meet deadlines with either of them. The communities are
smart the docs are great. You can't really go wrong any way you slice it.
There's more third party documentation and books for Django right now but
that's just because Django came out first. Give it another couple years and
there won't be much difference.

Basically, flip a coin and just go with it.



And now for the gritty details approach...

The problem with web frameworks is they are "magic", i.e. things just happen.
It's the price we pay for using a high level abstraction. The higher the
abstraction the more magic there is. Often times magic is good. It saves us
time and money. However depending on your needs, other options are worth
considering.

If you are willing to invest a lot of time not being initially productive but
learn a *ton* in exchange, you can use something like cherrypy. (Don't get me
wrong, I love and often use cherrypy.) It's dirt simple and works. However,
because it's so simple it doesn't do half of what you need for a non-trivial
production site. Result? You'll have to fill in the tool chain gaps with other
modules. This is what web frameworks do for you.

If you go the cherrypy route you'll need to learn other things like like markup
languages and some kind of way to talk to a database. Security is also entirely
in your hands. You'll learn a ton about HTTP, SQL, markup languages, web
security, encryption, etc. You'll be basically re-creating a web framework of
your own brand. Again it's a time spent vs. knowledge gained trade off.

For a template language I really liked wheezy.template but it's a little too
new for me to feel comfortable using it on any big project. It has a very
simple inheritance model, which is refreshing. I hope to use it more in the
future.

I usually use Mako for my templates. By 'template' I mean any template, not
just HTML. I use mako for HTML, documentation, I even use mako to write SQL
templates. The inheritance model of Mako takes a little more mental gymnastics
to wrap your head around than the simpler (read nicer) wheezy.template model,
but it's a more mature code base. (Not as mature as cheetah.) I had only minor
experience with cheetah but found I preferred Mako. It was a matter of taste.
There's nothing wrong with cheetah.

As for database access: sqlalchemy is truly excellent and very flexible. For
most things sqlalchemy is great. However for some projects it may contain too
much magic. (Again we're going deeper.) Sometimes a backend-specific module is
called for, in which case psycopg2 on postgresql is nice. The ability to use
python context managers as transaction blocks is very clean.

In short, how much do you want to learn? Do you prefer a top-down or bottom-up
approach? Gritty details or elegant abstractions?

-Modulok-



More information about the Python-list mailing list