Earlier quoted context omitted.
Don't use Tornado unless you plan to build a full SOA. Python drivers are blocking by default and Tornado offers no support for that, meaning Tornado blocks if you have database calls in your code. Use gevent. Huge community. Simply works and simply scales. And it makes all your blocking calls nonblocking automatically. Tornado just blocks.
thats a bit of a simplification - you can definiltey use tornado as long as you've got a tornado compatible async driver. people using mongo, postgres, or anything with an http interface are fine. Not wanting to deal with the mental overhead of callbacks, is the reason why I no longer want to use tornado
Ask HN: Best Python web framework
81–90 of 110 posts
Re: Ask HN: Best Python web framework
#82Try Brubeck. It's a Python web framework built around Gevent, DictShield and ZeroMQ. It communicates with Mongrel2, it's web server, via ZeroMQ sockets so even the annoying design of WSGI is moved out of the way. It converts your blocking calls to nonblocking, has no spaghetti code filled with callback shenanigans, and can even generate a full REST API for you. https://github.com/j2labs/brubeck
I have used Pylons, Tornado and Brubeck in my projects over last couple of years and I must say if you are an experienced developer in Python, brubeck is a very good candidate. It is built for scalability in mind from day one. It is very light weight from code perspective and has a very transparent design which is very easy to understand to dive deeper if you need to.
Re: Ask HN: Best Python web framework
#83Try Brubeck. It's a Python web framework built around Gevent, DictShield and ZeroMQ. It communicates with Mongrel2, it's web server, via ZeroMQ sockets so even the annoying design of WSGI is moved out of the way. It converts your blocking calls to nonblocking, has no spaghetti code filled with callback shenanigans, and can even generate a full REST API for you. https://github.com/j2labs/brubeck
>Availability: 99.98 %
>Failed transactions: 2
I am guessing Brubeck runs solid now. But that benchmark was done 5 months ago and it's still advertised on this page. http://brubeck.io/readme.html
Re: Ask HN: Best Python web framework
#84(Full disclosure: I'm a member of Django's core team) There's no single "best" for every application. One-size-fits-none. One of Django's strengths is in the fact that parts of the framework come off easily when they no longer serve your needs. If the ORM is no longer working for you, you can use SQLAlchemy or write raw SQL. Authentication no longer working for you? Write your own or use a 3rd party one. Et cetera. T…
I use both and personally if I'd have to generalize I would say Django for simpler stuff and Flask for complex stuff. Flask is great if you're going to do a complex app. All the interface will be custom designed (so the Django admin is of no use). You have a database heavy app, SQLAlchemy is more flexible than Django ORM and allows greater SQL expression, Unit of Work etc. Jinja2 is more flexible then Django template…
I don't even want to sum up the amount of time that Django would have solved my problem instantly, but instead I had to pull my hair out dealing with Flask's global variables, circular dependency issues, and general lack of cohesion or standards. I think it's a great micro-framework if you're writing a one-python-file personal site or blog. Anything larger than that and you're going to regret it.
Re: Ask HN: Best Python web framework
#85Try Brubeck. It's a Python web framework built around Gevent, DictShield and ZeroMQ. It communicates with Mongrel2, it's web server, via ZeroMQ sockets so even the annoying design of WSGI is moved out of the way. It converts your blocking calls to nonblocking, has no spaghetti code filled with callback shenanigans, and can even generate a full REST API for you. https://github.com/j2labs/brubeck
Yes, Brubeck is awesome. What irritates me is this benchmark. https://gist.github.com/882555 >Availability: 99.98 % >Failed transactions: 2 I am guessing Brubeck runs solid now. But that benchmark was done 5 months ago and it's still advertised on this page. http://brubeck.io/readme.html
I have since switched over to Gevent and the performance is significantly better than Tornado now. I will update this test very soon to demonstrate.
Re: Ask HN: Best Python web framework
#86-- Advantages --
* Minimal configuration (No configuration file, just run a single python file in the simplest case)
* Getting started is really fast
* import whatever libraries you like (PyMongo, SqlAlchemy, Mako, Beaker, etc) - No lock in
* The Web.py source is straightforward enough that you can go directly there to figure stuff out
* WSGI compatible
* No Admin interface and extra scaffolding
* Very simple URL routing interface
* Simple cookbook is available for adding basic features
-- Disadvantages --
* Smaller community
* Not a lot of documentation or guides
* Some problems will require you to look at the source
* No built in user management/auth
* Web.py development community isn't adding new features rapidly
--Conclusion--
Probably good for rapidly building simple web apps. It seems like the support/infrastructure needed for a large-scale production app isn't available. However if you are willing to build out your components it will give you maximum flexibility for a larger app
Re: Ask HN: Best Python web framework
#87Pyramid. http://en.wikipedia.org/wiki/Pyramid_%28web_framework%29 * faster. * better quality (100% statement coverage via unit tests) * supports latest python. * great documentation (including free up to date book). There's also a separate pyramid cookbook. * simplicity. If you just see a pyramid app, you can dive right in fairly easily without learning lots of alien stuff. * sensible defaults, and you can choose to…
As an alternative viewpoint * It's complicated * It doesn't really do much for you (have to spend lots of effort/time/learning plumbing in all the 3rd party libs) * Lacks sensible defaults for many things * Documentation is rather lacking. Oh, there's tons of it, but it's rather maze-like and hard to use if you don't actually understand the system. High-level overview/cookbook type stuff is severely lacking.
My previous company has a huge SQLAlchemy-based codebase with literally hundreds of defined classes, many with hugely complex relationships (as it was built on top of a legacy database that had accreted over many years). Switching to a non-Alchemy backend simply wasn't an option. They also have a large, complex web application built in Zope with hundreds of tested, working page templates. Django is the easy first choice when starting a new Python web app. However, if we'd replaced the Django ORM with SQLAlchemy and Django's templates with something like ZPT so that we could incorporate our large pre-existing code, there wouldn't have been a lot of Django we could still use. In particular, the admin would have been virtually unusable without a large amount of reimplementation to adapt it to our internal code.
Pyramid was a big win for us in that it used our preferred backend choices by default. More importantly, though, was that it's comparatively very easy to change those defaults without losing the rest of Pyramid's features. After a couple of hours of experimenting with integrating our legacy codebase, I had new pages up and running.
I have nothing bad to say about Django and I've used it successfully in other projects. It's a neat framework with a lot of talented people behind it. But Pyramid has its own charms, especially for those who absolutely need to do things their own way.
Re: Ask HN: Best Python web framework
#88Tornado. Built-in async operations. Not standing in your way. Rapid developments. Huge community. Simply works. Simple, yet rich.
Don't use Tornado unless you plan to build a full SOA. Python drivers are blocking by default and Tornado offers no support for that, meaning Tornado blocks if you have database calls in your code. Use gevent. Huge community. Simply works and simply scales. And it makes all your blocking calls nonblocking automatically. Tornado just blocks.
Re: Ask HN: Best Python web framework
#89Don't listen to the naysayers about web2py -- it is rare to find one who has actually ever used it. Meanwhile, web2py has a large, active, and steadily growing base of real users who are very happy and doing just fine producing and maintaining web applications with it. In fact, many web2py users are former Django users who simply find web2py more productive (see http://www.quora.com/What-are-the-advantages-of-web2py-over-...).
Note, most of the criticisms of web2py have all the earmarks of FUD (http://en.wikipedia.org/wiki/Fear,_uncertainty_and_doubt) -- lots of references to authority and calls to stick with a perceived standard way of doing things, but not much discussion of actual technical merits nor presentation of any empirical evidence to back up the strong claims being made (see http://www.quora.com/Is-web2py-a-good-Python-web-framework/a...). Some of the critics seem overly concerned with the notions of "explicitness" and "magic", but not everyone shares their concerns: https://twitter.com/#!/zedshaw/status/80418794526351360.
Re: Ask HN: Best Python web framework
#90(Full disclosure: I'm a member of Django's core team) There's no single "best" for every application. One-size-fits-none. One of Django's strengths is in the fact that parts of the framework come off easily when they no longer serve your needs. If the ORM is no longer working for you, you can use SQLAlchemy or write raw SQL. Authentication no longer working for you? Write your own or use a 3rd party one. Et cetera. T…
I've just gone over the public discussions. They could basically be summarized in two points:
jacobian&ronacher dislike web2py's inclusion of a few new "builtins" (that is, they are builtins for a web2py applications). They used extremely colorful terms ("divisive! harmful!"), but that's essentially what it boils down to: It's fine that "len", "dict", and "list" are builtins, but it's horrible that web2py introduces a few more for web2py apps ("request", "response", "session", and a few others). Well, that's not much more than a difference of opinion. They feel very strongly about it, for some reason.
ronacher also dislikes web2py's use of "exec" for some reason. Almost all of his criticism is meritless (web2py precompiles for production, and the namespaces are used as he thinks they should be). The part that isn't, about classes with destructors leaking is valid, but it's a general Python "bug" that web2py potentially amplifies if you use it -- but it is not idiomatic in either Python or Web2py.
It's rather telling that every single strong criticism of web2py you can find on the web comes from someone who has never used it, and more often than not has some vested interest in a competing framework.
Web2py is not perfect, far from it -- but it is extremely well built, very robust, has a lively and helpful community, and gets things done quickly and well. Give it a try when you have the time and feeling curious.