Live data from Hacker News

Ask HN: Best Python web framework

news.ycombinator.com

61–70 of 110 posts

Re: Ask HN: Best Python web framework

#61
post #19

(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…

"a fundamentally incorrect way to approach web development" - crikey! can you explain what i've been doing wrong, please?

I've never encountered those flamewars before (I don't know web2py), but I searched a bit, here is the web2py dev discussing one particular criticism:

https://groups.google.com/d/topic/web2py/dmN54cpMuXo/discuss...

https://groups.google.com/d/topic/web2py/GQWCsNzwP28/discuss...

Armin Ronacher's take: http://lucumr.pocoo.org/2011/2/1/exec-in-python/

Re: Ask HN: Best Python web framework

#62
As with whichever framework you choose you will have to get inside its code to understand it, adapt to it or fix it, I would advise to choose one framework that has code that is pleasing to read and follow very strictly conventions. Right now my box is broken so I can't check but last I have checked Django had a relatively good pylint score, while Flask had a seemingly slightly more messy code base.

Re: Ask HN: Best Python web framework

#63
post #19

(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…

Kind of offtopic, but since you're a core dev ...

One of my pet peeve with Django is the reliance on settings.py. This makes it a PITA to use Django's components in apps that aren't necessarily Django apps (or web apps for that matter).

For instance Ruby on Rails got separated in components and you can now import ActiveRecord in any project, without it being a Rails project or having a Rails project structure. Ditto for their database migrations ... you don't even need to use ActiveRecord to have the migrations DSL in a project. Doing this with Django's ORM is really, really ugly, mostly because of the reliance on a Django project structure. Why can't it be configured like any other Python library, in a pythonic way? Why does it need a global "settings" module?

Another pet peeve I've got is with the definition of an app. I hate what Django means by "app". It's totally un-pythonic. First of all the definition is unclear ... is it a module declared in settings.py? Not so fast, as some functionalities (e.g. manage.py test) expect those modules to have a "models" sub-module, even if it is empty.

Why does Django need apps anyway? It only needs apps for auto-discovery of model definitions. This goes back to Django's admin, which is a cool piece of software that I love, but how about declaring somewhere the modules that represent models, instead of building an unpythonic project structure?

I'm happy to hear that along with Django 1.4 you guys are working on project templates (really, that's awesome). But please strive to make it more pythonic / decoupled.

Re: Ask HN: Best Python web framework

#64
web2py is great. Really. I'm quite sure some people are confusing web.py (toolkit behind reddit) and web2py - I know I was a couple of years ago.

web2py is super complete, but doesn't get in your way, and doesn't require you to learn everything up front. It's DAL is much simpler (and in my opinion, much more effective) than an ORM -- but you don't have to use it.

Its templating system is just plain python inside {{}}, where you need to add "pass:" to dedent if it cannot be inferred from the code, but that's it. No need to learn a new templating system.

The community is super awesome. Starter applications like issue trackers, minimal facebooks or twitters etc. are often posted on the mailing list inside one short message (not as an attachment -- the whole thing is posted inside the message text, and takes no more than two screenfuls)

Really, give web2py a try if you haven't.

Re: Ask HN: Best Python web framework

#65

Sadly, Django is still by far the most popular. It's ok, though. You're likely to not hate it intensely. It also has a lot of third party code available, and a fair amount of functionality built-in. Flask is nicer (and lets you seamlessly use SQLAlchemy, which is so much better than Django's crappy ORM), but also tiny. It's basically just a bit of glue between werkzeug, SQLAlchemy and Jinja2. Pyramid has more things…

Why does web2py appear bad to you?

It is less popular than django, sure. But it is reasonably popular - with books about it coming out and selling well, and a lot of users, see http://web2py.com/poweredby including pycon registration websites.

Re: Ask HN: Best Python web framework

#66

Sadly, Django is still by far the most popular. It's ok, though. You're likely to not hate it intensely. It also has a lot of third party code available, and a fair amount of functionality built-in. Flask is nicer (and lets you seamlessly use SQLAlchemy, which is so much better than Django's crappy ORM), but also tiny. It's basically just a bit of glue between werkzeug, SQLAlchemy and Jinja2. Pyramid has more things…

based on forum activity web2py was the second most popular python web framework (after Django) last time I checked. It is primarily unpopular among developers who haven't used it.

Re: Ask HN: Best Python web framework

#67
post #61

Earlier quoted context omitted.

"a fundamentally incorrect way to approach web development" - crikey! can you explain what i've been doing wrong, please?

I've never encountered those flamewars before (I don't know web2py), but I searched a bit, here is the web2py dev discussing one particular criticism: https://groups.google.com/d/topic/web2py/dmN54cpMuXo/discuss... https://groups.google.com/d/topic/web2py/GQWCsNzwP28/discuss... Armin Ronacher's take: http://lucumr.pocoo.org/2011/2/1/exec-in-python/

Ta - sadly, I'm all too familiar with it.

If I found myself talking to someone who had used web2py, I'd be very interested in their critique, but sadly in every case so far, it's been second hand.

Going back to the original discussions about this, and discounting the unnecessarily intemperate language used, it seems to boil down to web2py's conscious design decisions being discounted as "Pythonic heresy" - fair enough if that is your PoV, but that's a long way from "a fundamentally incorrect way to approach web development".

Re: Ask HN: Best Python web framework

#68
I have used web2py for the last few years and have been happy with it:

- well designed components: DAL, SQLFORM, views, etc

- commitment to backwards compatibility

- works on GAE

- helpful community (groups.google.com/group/web2py)

- thorough documentation (web2py.com/book)

The main criticism of web2py is that its design is not 'pythonic', which is irrelevant to me.

Re: Ask HN: Best Python web framework

#69
post #59
post #17

Tornado. 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.

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
Post reply on HN