9 ms·
I would say Flask is genuinely really difficult to use. It's very easy to start with but the moment your project becomes non-trivial, it's a mess of wires and p
by aniforprez 5y ago
I would say Flask is genuinely really difficult to use. It's very easy to start with but the moment your project becomes non-trivial, it's a mess of wires and plugs that resembles something like Django anyways but all maintained by you or your team. FastAPI seemed like something that's in a solid middle ground between something beefy like Django but something light like Flask and it's much easier to start with since it gives you REST and form/JSON validation out of the box
That said, FastAPI seems to have a lot of issues and the maintainer doesn't seem to be responding to the numerous PRs that are piling up. I'd much rather just stick with Django at this point
- nickjj 5y ago> I would say Flask is genuinely really difficult to use. It's very easy to start with but the moment your project becomes non-trivial Do you have specific examples? I've built a number of decently large Flask apps over the years (dozens of blueprints, 100+ models, etc.) and it was never an issue. I've used similar code organizational patterns in both small and large apps and it worked great. It was a combination of solo projects and working with small teams.
- WD-42 5y agoI share OP's general statement. I've been using Flask and Django on and off for near a decade. When deciding between Flask and Django, I look at the following requirements: User accounts Object Relational Manager Database Migrations User registration/social authentication Admin Site As a general rule of thumb if my project is going to need 3 or more of these things I just go with Django. You CAN do all of that with Flask, but you end up wiring together a bunch of third party dependencies just to end up with what Django would have provided you out of the box.
- zippergz 5y agoFastAPI doesn't (directly) help with most of these either, so that's really a Flask vs. Django comparison rather than Flask vs. FastAPI.
- aniforprez 5y ago> solo projects and working with small teams As I said, any time a Flask app becomes non-trivial, it's a pain. Engineering scaled up from 10 to 30 and immediately it was apparent what a massive pain it all was. We had to implement auth, access control, caching, API documentation, admin panel etc etc all on our own. Flask plugins are very fickle with a lot of them not being maintained anymore that don't fit our use cases. If you need all these things in a customer facing app, you might as well just use Django. Performance suffers a little but the ease of developer onboarding and batteries included in the framework, coupled with a lot of well maintained popular plugins honestly make Django the de facto choice for web app dev that needs to scale. Flask is good for small services being maintained by small teams
- nickjj 5y ago> As I said, any time a Flask app becomes non-trivial, it's a pain Results may vary. Small teams doesn't mean small apps. You can have 150 models, dozens of screens, caching, background jobs, rate limiting, multiple payment providers, multi-tenancy, public APIs and other features you would expect in a decently sized SAAS app and it's fine. The popular Flask extensions for certain behavior are pretty well maintained. There's also a number of Python libraries that can get used in a Flask app that aren't specific to Flask but are very well maintained like SQLAlchemy and Celery. I wouldn't say Flask is better than Django or Django is better than Flask but I think you can be wildly successful building an app with either one. It comes down to personal preference. Your post made it seem like Flask is some graveyard of dead libraries and you can't build anything successful with it but that's not the case.
- WD-42 5y agoCheck out Django Ninja: https://django-ninja.rest-framework.com/ https://django-ninja.rest-framework.com/ It's like a FastAPI inspired Django Rest Framework. In comparison to DRF it feels very lightweight and modern, but it's still Django underneath so you get to keep the ORM, admin, etc. Speaking of the ORM, once Django's is async Ninja will really be amazing.
- bluewalt 5y agoI must +1 this, Django ninja is outstanding.
- privacyonsec 5y agoIf you wanna experiment Django async you can try this module : https://github.com/rednaks/django-async-orm https://github.com/rednaks/django-async-orm