Hacker News new | ask | show | jobs
by lhnz 5447 days ago
There are so many different web frameworks available for Python now. How would somebody make the choice over Brubeck, Flask, Bottle, web.py, Django, Pylons, etc... I know somebody will probably say something like "use the best tool for the job" but what is best for what job?

edit; That's just Python frameworks. The situation gets even messier when you start to consider every other languages for web development. Lots of 'hip' technologies I would love to put time into learning but I can't learn them all...

2 comments

Brubeck is a Mongrel2 handler which makes it effectively a ZeroMQ Framework. But it is built with web serving in mind so I (I wrote it) attempted to also bring many of the customs we're used to with web frameworks to the Python + Mongrel2 world.

There are many python frameworks and each serves a different need. If you are a Tornado user but find the blocking / nonblocking paradigm confusing, you would probably get a lot out of Brubeck because it replaces the IOLoop (like Twisted's reactor) with a simpler system, eventlet.

I'm glad you think it's hip! It's only a couple months old.

Agreed. For a newcommer, the question "which framework is most worth my time investment" has has become rather daunting. Seems like the safest choices are the big ones like Rails or Django, but there always seems to be something tempting and fun on the horizon.
"Spending too much Time with the Choice of Framework

This should probably go to the top. If you have a small application (say less than 10.000 lines of code) the framework probably isn't your problem anyways. And if you have more code than that, it's still not that hard to switch systems when you really have to. In fact even switching out core components like an ORM is possible and achievable if you write a little shim and get rid of that step by step. Better spend your time making the system better. The framework choice used to be a lot harder when the systems were incompatible. But this clearly no longer is the case."

http://lucumr.pocoo.org/2010/12/24/common-mistakes-as-web-de...

That is a goal of Brubeck too. By using DictShield for modeling you get all your modeling needs, including serializing to Python dictionaries or JSON strings, but it doesn't have an opinion on what database you us.

Your database layer might change, for whatever reason, so you adjust a few queries for loading data and you're back in action.

In addition to this many people haphazardly choose their framework and make the mistake of using Tornado without understanding how nonblocking I/O works. If a user chooses.

Brubeck, they would get nonblocking support for free, which makes it a considerably safer haphazard choice.

Is there a Socket.IO interface, such as Tornadio (https://github.com/MrJoes/tornadio) for Tornado?
try gevent-socketio
I think it's unfortunate that the power of choice isn't as appreciated outside the Python world but I can also relate to people who feel they have to read way too much stuff.

In spite of this, however, Brubeck indeed aims to be a one-stop shop. It uses coroutines + nonblocking I/O to make scaling up easy but it also a web.py style routing system because all of us know this style already.

Choice is great for veterans, but for someone learning Python or Ruby, how do they know what to pick? How to they know that they're not going to bet on a losing horse that stops being actively developed after a while and doesn't do anything for their career. Veterans can afford to play around and test out new frameworks, because they can always fall back to Django or whatever pays the bills, but newbies can't.
They have to do their homework, ask around, and make the best possible guess. And more importantly, focus on the more general skills than the specific framework.

If someone is getting started in a vacuum, they're doing it wrong.

Also consider that some frameworks (ala Django) go for the 'kitchen sink' approach which is better for newcomers. Others (like Express with NodeJS) just do a few minimal helpers and otherwise get out of the way.

In this case, the plethora of frameworks is an advantage for the advanced developer, while the few big obvious ones stand out for newcomers.