Live data from Hacker News

Ask HN: Best Python web framework

news.ycombinator.com

11–20 of 110 posts

Re: Ask HN: Best Python web framework

#11
Depends on what you are developing, of course.

I picked web2py about 3 years ago, and it has worked well for me. I'm developing CRUD apps to solve business problems with the minimum of fuss and effort, but with the confidence that I can roll my sleeves up and exercise more control if I need to - web2py has been a good fit for that.

Re: Ask HN: Best Python web framework

#12
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():
        name     = request.forms.get('name')
        password = request.forms.get('password')
        if check_login(name, password):
            return "

Your login was correct

" else: return "

Login failed

"

Re: Ask HN: Best Python web framework

#13
post #6
post #4

The best for what? What do you want to do? We have found Django to be great for throwing up a site quickly. We primarily use Pyramid now for our more serious development as it fits more with what we're trying to achieve. My feeling is the beauty of Python is that there are more than one ways of doing something. Define what you want out of your framework, try some and then see how you feel

The specific project I'm looking at is a small photo-sharing app for a newspaper website. Functionally simple, but with some pretty intense traffic spikes. Since it's a straightforward job I'd like to use it as an opportunity to switch to Python, which I've been itching to do for a while (alternative would be Symfony on PHP). However I have a longer term concern, which is that I don't want to be learning a new framew…

Some stuff I know:

Django is great for learning very fast. It has all the documentation in one place. There's generally one way to do any one thing with Django.

Pyramid is super flexible because it's not much of a framework to begin with. Think of it as glue to stick together a bunch of components to handle specific parts of your app (like database ORM, cache, sessions etc) and you can use any components that you like. Pyramid is harder to pick up than Django though because of this reason.

Pyramid is faster than django on benchmarks I've seen on the web (but this will hardly matter in the real world in my opinion)

Both have some big projects executed using them(Disqus is written in Django and Reddit is written in pylons for examples)

There are a bunch of other python frameworks that I haven't used yet so I can't tell you anything about them.

I'm currently working on something using Pyramid so if you have something specific you want to know, I'll try and answer (I'm new to this too)

I'd recommend learning django first though. It's what you should look at if you want a quick inroad into python web frameworks without much time spent learning.

Re: Ask HN: Best Python web framework

#14
post #6
post #4

The best for what? What do you want to do? We have found Django to be great for throwing up a site quickly. We primarily use Pyramid now for our more serious development as it fits more with what we're trying to achieve. My feeling is the beauty of Python is that there are more than one ways of doing something. Define what you want out of your framework, try some and then see how you feel

The specific project I'm looking at is a small photo-sharing app for a newspaper website. Functionally simple, but with some pretty intense traffic spikes. Since it's a straightforward job I'd like to use it as an opportunity to switch to Python, which I've been itching to do for a while (alternative would be Symfony on PHP). However I have a longer term concern, which is that I don't want to be learning a new framew…

[deleted]

Re: Ask HN: Best Python web framework

#15
post #4

The best for what? What do you want to do? We have found Django to be great for throwing up a site quickly. We primarily use Pyramid now for our more serious development as it fits more with what we're trying to achieve. My feeling is the beauty of Python is that there are more than one ways of doing something. Define what you want out of your framework, try some and then see how you feel

from ">>> import this" "There should be one-- and preferably only one --obvious way to do it."

it's a bit of a stretch to apply that to selecting a framework!

You'd have to define the "it" being done to make that meaningful...

Re: Ask HN: Best Python web framework

#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. The key aspect is that you don't need to sacrifice the entire framework when only one part of it no longer addresses your needs. Keep in mind that 99% of sites never even reach this point.

The other major strength of django is the rich ecosystem of 3rd party apps. That's a lot of code you don't need to write yourself.

That being said, Flask is popular for a reason. Django offers a lot of power, which means adding some complexity to even the simplest projects (something we're working to address with features like project templates in Django 1.4). Flask fills a niche for a framework that is easy to get up and running and addresses 90% of the things which 90% of people need for many projects.

I've heard good things about pyramid, but haven't had a chance to play yet.

I haven't had the "pleasure" of working with web2py, and I'm not knocking the effort which Massimo puts into it, but the choices made there often elicit a raised eyebrow. Ignoring my opinion for a moment, the smartest web hackers I know universally regard web2py as a fundamentally incorrect way to approach web development—but usually say so in far more colorful terms.

TL;DR

* Flask for simpler stuff

* Django for anything larger, or simple stuff that leverages a 3rd-party app you need.

* What matters is the app you ship, not the framework it was built with.

* Django developers are in super-high demand. I get cold-called frequently.

Re: Ask HN: Best Python web framework

#20
post #10

I use web2py. It struggles to get the attention that Django gets, but it has a robust development community. It offers a good balance between Django (which i find a little big and unwieldy), and Flask (which I think suffers from the opposite problem).

What's the opposite problem?
Post reply on HN