I understand that Flask has become popular because it is easy to learn, but my experience is that as your knowledge progresses it just keeps getting in your way. I particularly dislike some design choices which look like afterthought hacks, such as global variables for current request and using abort() functions instead of raising exceptions directly. EDIT: To avoid hollow naysaying, here are some alternatives to Fla…
>global variables for current request Not really global variables. I would analogize it to dynamic variables from Lisp, which are a feature I wish every language had. I strongly disagree it's a hack or gets in the way. Having access to the request from anywhere without explicitly passing it around is really useful.
Flask 1.0 Released
111–120 of 184 posts
Re: Flask 1.0 Released
#112Earlier quoted context omitted.
Check out Sanic if you want an async python framework with a similar API to flask
Its pretty hard to beat Tornado's api, IMHO. Its a really rich api for how simple and quick it is to learn. Flask is a definite downgrade to me, when it comes to the api. But Flask wins hands down on the richness of its ecosystem.
Re: Flask 1.0 Released
#113Flask has a stigma for not being that good when building larger apps, but honestly Flask scales really well for that type of use case (coming from a development / maintenance point of view). I have some pretty large Flask apps with dozens of top level dependencies and models spanning across many thousands of lines of code. Even if I don't touch the code base for a few months, it's easy to jump back into it. I'm also…
How do other users of Flask handle async calls to third party APIs? I use celery which works okay but it still feels quite clunky.
What feels clunky about celery? The third party broker? Bunch of "magic" code you feel can be simpler as a couple of pika modules? While I like pika it needs a bunch of boiler plate[1] where celery is just multi-broker batteries included solution... which might feel a bit clunky.
I see a lot of zmq solutions in the wild. But I'm happy with my current setup.
[0]: https://github.com/jpmens/mqttwarn [1]: https://github.com/pika/pika/blob/master/examples/asynchrono...
Re: Flask 1.0 Released
#114Earlier quoted context omitted.
Why is Zero Versioning a good idea?
I believe the parent comment and ZeroVer are tongue-in-cheek. Reading through the site brings Poe's Law to mind.
Countless people are already using 0ver, and always will. In other words, 0ver.org is descriptive, not prescriptive.
Re: Flask 1.0 Released
#115Earlier quoted context omitted.
> Flask has a stigma for not being that good when building larger apps Not sure how to quantify that "large" but I've worked on some api backend services written in Flask with a quarter million lines of python code and not feeling "outgrowing" Flask. Granted, it took some good design and effort to make all piece s work together. These days, horizontally scale apps is the way to go.
In my experience, Django is less suitable for large projects than Flask. The nature of Django encourages tight coupling between unrelated parts of the system - Models intertwine database operations and business logic, ModelViews intertwine db operations, business logic and the interface layer. This is manageable in the small, but when you hit scale, this tight coupling adds a whole bunch of unnecessary complexity to…
> The nature of Django encourages tight coupling between unrelated parts of the system - Models intertwine database operations and business logic, ModelViews intertwine db operations, business logic and the interface layer.
It totally depends how your architect your application and how you write code.
Any framework you choose, you need to write good code, keep an eye on db operations, enable caching where it is required and you will survive the scale just fine. All the arguments are exactly same in the favor of slack.
Do not spread the FUD that using a framework can magically make your application scale. I have seen very bad and very good code in both Django and flask. If you want your application to scale, you need to carefully work on it there is no silver bullet.
Re: Flask 1.0 Released
#116wow, lot of Flask haters here. I personally love it and have used it for a ton of smaller projects. For example, I just deployed this a couple days ago: http://dadjoke.info
Re: Flask 1.0 Released
#117Earlier quoted context omitted.
My employer made me switch from Flask to Django providing non-scalability reason. I asked around on a few online forums and they told me that flask has no such issues. There was an article where somebody from DISQUS explained how they were able to use flask in production without much hassel and there's no reason to switch to django. My employer told me to not use flask as it is not production grade. The problem was t…
I've been developing with Django since the 0.90 days and, to be honest, I've seen a lot of scalability issues with Django itself once you get big enough. Those issues all relate to how Django is an all-in-one solution with a lot of modules, which you start dropping one by one as you use different solutions. For example, Django's cache layer is great, but as you scale you'll want to use Redis clients directly rather t…
Any articles or blog posts you can recommend to give some examples or comparison?
> entire Django ecosystem of apps that make heavy use of the model layer.
Exactly why I don't want to use the django system. I'm happy with the python ecosystem and have yet to find a django only module where no other alternative exist.
Its not that django is a bad web framework; on the contrary, to be honest. I'm just already invested in other modules that django decided to re-invent/design to fit their needs better.
Re: Flask 1.0 Released
#118Earlier quoted context omitted.
I think its explicitness is hugely wonderful for maintenance I find all the magic really off-putting in Flask…
I thought what the parent comment meant was that there's little to no magic in Flask compared to some macro-framework like Django/Spring. Can you get any more explicit than Flask and still be called a framework, without hitting the socket levels?
Re: Flask 1.0 Released
#119Earlier quoted context omitted.
>global variables for current request Not really global variables. I would analogize it to dynamic variables from Lisp, which are a feature I wish every language had. I strongly disagree it's a hack or gets in the way. Having access to the request from anywhere without explicitly passing it around is really useful.
OK, fair point, I used a wrong term here. So instead of global variables we have dynamic modules that represent a stateful context object which is different depending on where they are imported and when. Very un-Pythonic, and honestly I'd prefer global variables here. :-/
Er, no. Their value depends on where in the callstack you read it, not on where/how they're imported. They're like global variables but with thread locality, and with a stack of values.
Re: Flask 1.0 Released
#120Earlier quoted context omitted.
Just use sanic. It's a mostly drop in replacement for flask that is async first and runs on uvloop.
The unfortunate bit is you lose out on so much of the ecosystem going hard on asyncio right now though (like sqlalchemy orm).