Live data from Hacker News

Ask HN: Best Python web framework

news.ycombinator.com

21–30 of 110 posts

Re: Ask HN: Best Python web framework

#21
I'm surprised nobody mentioned brubeck (http://brubeck.io) until now, which takes a completely fresh approach to concurrent handling via implicit context switching (more on their website).

Obviously, as idan mentioned already, there is no single "best" framework, so it really depends on the type of application you want to build whether you should choose something like bottle/flask, django/mezzanine/pinax or brubeck/tornado, or even twisted.

Re: Ask HN: Best Python web framework

#22
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…

> 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. Authentication no longer working for you? Write your own or use a 3rd party one.

Yes and no (disclaimer: I mostly use Django for my development), while parts come off easily the tools provided by the framework are "standard" and taking them off usually means not being able to take advantages of many Django features, e.g. if you replace django's ORM with SQLAlchemy, you'll have to say goodbye to the admin or to ModelForms, if you don't use Django's auth then extensions to it (django-registration &al) will have to be torn-out and/or reimplemented, ...

So while theoretically you can remove things, it's not a straightforward process and it'll likely be a lonesome road.

Re: Ask HN: Best Python web framework

#23
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?

Re: Ask HN: Best Python web framework

#24

I really like bottle.py [1]. I've used it for a couple of different projects; although not fundamentally different from web.py or flask, it seems to just "make sense". [1] http://bottlepy.org/docs/stable/ An example from their website: from bottle import get, post, request @get('/login') # or @route('/login') def login_form(): return ''' ''' @post('/login') # or @route('/login', method='POST') def login_submit(): nam…

PHP guy here, don't know much about other languages, but seeing HTML mixed in with code is usually a bad code smell. Is this type of thing common in Python?

Re: Ask HN: Best Python web framework

#25
post #7

Pylons is now called pyramid. I don't know how much it changed? I prefer pylons above Django. Simply because it feels less like a framework.

> I don't know how much it changed?

All of the controllers stuff was replaced with the code formerly known as repoze.bfg

Re: Ask HN: Best Python web framework

#26
post #17

Tornado. Built-in async operations. Not standing in your way. Rapid developments. Huge community. Simply works. Simple, yet rich.

The "simple" bit is what I love about Tornado. You only have to deal with RequestHandlers and Applications - no Flask-like automagic object proxies which make you do everything within the lifetime of a request. The API is clean and easy to hack.

That said, you can't go too far wrong picking Python web frameworks. They each have their strengths and weaknesses, but on the whole they're all fairly competitive offerings with helpful communities. If you don't find something you like then it's pretty trivial to roll-your-own from existing components like Werkzeug, WTForms, SQLAlchemy, Jinja, beaker, Mako, etc.

Re: Ask HN: Best Python web framework

#27

I really like bottle.py [1]. I've used it for a couple of different projects; although not fundamentally different from web.py or flask, it seems to just "make sense". [1] http://bottlepy.org/docs/stable/ An example from their website: from bottle import get, post, request @get('/login') # or @route('/login') def login_form(): return ''' ''' @post('/login') # or @route('/login', method='POST') def login_submit(): nam…

PHP guy here, don't know much about other languages, but seeing HTML mixed in with code is usually a bad code smell. Is this type of thing common in Python?

No, it's not. He's just showcasing the simplicity of bottle.py

Re: Ask HN: Best Python web framework

#28
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…

I would simplify further:

Are you building an API? If yes, use Flask.

Are you building a website? If yes, use Django.

Are you building an API and a website? If yes, use Flask for the API and consume it from a Django site.

I wouldn't advocate using Django but ditching the ORM for SQLAlchemy, nor replacing the Auth, as noted (above or below my comment) it gets messy and becomes a lonely road fast.

I would advocate moving a lot (all?) of the model into a REST API, implemented in Flask, using SQLAlchemy. But perhaps my experience isn't as wide or deep as others.

Re: Ask HN: Best Python web framework

#29
Pyramid is probably the best at the moment. It has a lot of power when it comes to fine grained security utilizing access control lists and it integrates really well with the major python libraries out there.

Re: Ask HN: Best Python web framework

#30
post #28
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…

I would simplify further: Are you building an API? If yes, use Flask. Are you building a website? If yes, use Django. Are you building an API and a website? If yes, use Flask for the API and consume it from a Django site. I wouldn't advocate using Django but ditching the ORM for SQLAlchemy, nor replacing the Auth, as noted (above or below my comment) it gets messy and becomes a lonely road fast. I would advocate movi…

Sorry, but I wouldn't give up Django-TastyPie for anything else (including Flask) for API development. Sure, I could spend a month building an API framework from scratch in Flask for a project, but why would I?
Post reply on HN