Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Great post, thanks! I've also been working with Flask and have found it extremely flexible.

Does SendHub use Flask in any sort of production environment? It's always been touted as a great small framework, but rarely (if ever) do we hear about sites using it in some sort of large-scale effort.



At present, SendHub's public-facing API is pretty much all Django, but we've already ported several vital backend services off to their own Flask applications.

With regard to large-scale projects, the usage at SendHub is substantial. I am also aware of flask-restful[1], which looks like it could be useful for building out a more complex API service.

To be completely honest with you, I would gladly take Flask over Django/TastyPie or any of the other numerous Python frameworks I've worked with. For me it brings back the pleasure to coding in Python -- even if this is a case of redefining methods because Flask and Werkzeug are such thin layers that there is simply no configuration! There is certainly nothing comparable to the awesome power of Jetty on the JVM in Python.

[1] https://github.com/twilio/flask-restful


I would gladly take Flask over Django/TastyPie

Could you explain the benefits or difference for you?

Personally, I enjoyed using Tastypie, and when things weren't clear, its code was a pleasure to read and made things easier to understand or work out how to solve. Perhaps similar to your experience with the Flask code.

I imagine a thinner framework is cleaner in many ways, but then with a more robust framework you get stuff out of the box. In this particular case, getting the request time (+ if you want, sql time etc) is relatively easy and there are a few middleware options to do it in Django.

I've seen an interesting talk[1] by Yehuda Katz: "why rails is hard". One of the key points, if I can somehow paraphrase, is that with a bigger framework like rails, you get a lot more out of the box for the 'price' of it being heavier... He's comparing rails to node and sinatra, but the same might apply to the comparison between django/tastypie and flask I suppose.

Finally, I don't know about flask, but another important point in Yehuda's talk was that some of those things implemented for you, you might not even know that you need. This is true particularly for security, where you probably don't have to think about whether XSS/CSRF protection is implemented etc, you just want things to be secure by default and it's not a feature you even think about...

I am not saying flask doesn't have those (I don't know), just that in general that's usually the trade-off between heavier and lighter frameworks. (I think) I know the downsides, I'm curious to know about the upsides too.

[1]http://www.youtube.com/watch?v=2Ex8EEv-WPs


A form handling library Flask-WTF had CSRF handling enabled by default.

http://pythonhosted.org/Flask-WTF/

This page outlines some further security considerations:

http://flask.pocoo.org/docs/security/


There's Flask-SeaSurf which adds csrf to any POST or PUT request.


[1] Would you care to elaborate how Flask helps in writing backend services? It seems to be that most benefits of Flask are frontend related...

Do you talk over HTTP to backend services, encoding it via JSON?

[2] I didn't understand what you mean't about Jetty here (I like its philosophy too :)


#1: At SendHub we strive to always eat our own dog food, which translates to 99% of the data being accessed via JSON APIs.

#2: Jetty provides tons of configuration options, whereas Flask has very little in the way of configuration other than swapping out components.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: