Hacker News new | ask | show | jobs
by danibx 4751 days ago
I read somewhere that Flask was born as an Aprils first joke.

So I ask. How safe is it to use in a real project? Is it a serious project today? Would you recommend Flask to someone who has never done any server side programming?

7 comments

Yes, it's pretty reliable.

We (mailgun.com) use it in production, our deployment handles thousands of requests/sec, we have not seen any flask-related issues so far in 2+ years.

You can use pool of flask + twisted powered services behind nginxes:

Nginx ---upstream pool--> twisted.wsgi + thread pool + flask app

Something like that:

https://gist.github.com/klizhentas/5775158

Twilio uses it to run their API. So, that must be very reliable.

"Flask-RESTful was initially developed as an internal project at Twilio, built to power their public and internal APIs" http://flask-restful.readthedocs.org/en/latest/

While I'm not disagreeing on the quality of Flask, "x uses y, so y must be stable" is the same kind of argument as "Facebook runs on PHP, so PHP must be blazing fast." Yeah, there are large web companies using all sorts of tech, but what else they're using alongside it and how they've adapted it to their needs make this sort of commentary questionable at best.

It's definitely nice to see other responses here that are from people who are, first hand, using Flask in high-traffic live deployments. I'd just be careful about drawing conclusions based on who has it somewhere in their stack without any context.

>While I'm not disagreeing on the quality of Flask, "x uses y, so y must be stable" is the same kind of argument as "Facebook runs on PHP, so PHP must be blazing fast."

No, the argument is the same: "Facebook runs on PHP, so PHP must be stable".

Which makes sense. A base technology that holds up with half a billion users, I would call production ready.

As for fast, if you look at the most comprehensive benchmarks, PHP is more or less on par with Ruby/Python for raw speed of simple page serving, but when multiple DB connections are used in a page (which is the most common case for dynamic pages), it leaps far ahead, and reaches Servlet and Go levels of reqs/sec.

Fair enough in general, but I don't think my conclusion of "Twilio's API runs on Flask => Flask is very reliable" is too far-fetched in the context of Twilio, whose whole business is their API.

To be fair to your skepticism, I have probably followed Twilio more than you've had. I seem to remember that they switched to Flask, so I don't think it was technical debt that they had to work around later on. (like it might have been the case with Facebook and PHP)

Let's say that "Twilio uses Flask for their API" answers the question "can it be used in production?" (or "is it a serious project today?"). "Should you use it in production?" is where context matters more.

We use a bunch of tools up and down our stack, but the nginx+uwsgi+Flask part of our stack has been very reliable.

Every request to new-ish parts of the Twilio API touches Flask, and it's performed like a champ.

It's definitely production ready. We are using it everywhere in Close.io (http://close.io/)

If you're building a complex web app with it, just be sure to checkout all the Flask extensions so you don't have to reinvent the wheel too much.

Disqus were using it: https://ep2013.europython.eu/conference/talks/making-disqus-...

Though I think they may have recently replaced this bit of their architecture with Go?

FWIW, I've chosen Flask to power my startup and have no regrets at all. It's a joy to work with and rock solid :)

Regardless of Flask's humble beginnings, it is indeed a serious project, very stable, and quite awesome. And yes, I would recommend it for your use, assuming you want to learn Python as a whole. Flask is easy enough that you can start building an app right away, but at the same time, it leaves out all the extra 'magic' that ship with things like Django, so you'll be learning a lot more Python as you add onto your app. It's a great mix of simplicity and power, and is great for learning. Go for it.
I'm curious about what you think is "magic" in Django? It does have a lot more included than Flask/Werkzeug/Jinja2 but it did start in the era before Pip/VirtualEnv existed so a lot more had to be included.

After numerous purges (the magic-removal-branch being the biggest) and deprecations over the years since 1.0, Django is IMO pretty magic-free. If you have suggestions of what isn't Pythonic enough, I think the core team would appreciate a ticket on Trac:

  https://code.djangoproject.com/newticket
I think it's the different between a normal python application and a web app: url dispatcher/route, request handler, template, extension...I started with Django, but Flask clears thing better for me.
Please check out PyPI result page https://pypi.python.org/pypi?%3Aaction=search&term=flask&sub... it shows more than 400 related modules. Think it looks pretty serious.
We use flask at fusic.com and find it very reliable and easy to work with. Our peaks have over 1m rpm, and it has never fails us. We did a huge project migrating from Django, and now we don't have to jump through hoops so much.

I think flask has a front page that discourages newcomers, as it does not look as serious as Django, and gives the feeling that is it not mature enough, or documented. I tried convincing a new startup to use it and failed for those reasons.