DEV Community

Discussion on: Flask vs. Django?

Collapse
 
fluffy profile image
fluffy

I'd look at things a bit differently: Django is a complete software stack for building an application, whereas Flask is some decomposed building blocks which allow you how to pick and choose how to build your application. Flask can absolutely be used for larger things just as well as Django, it's just that Django gives you more Stuff out of the gate. But you might not necessarily want to use the stuff Django provides, or want or need the baggage of having it loaded.

Like, you might not even need an ORM, or if you do you might want to use SQLAlchemy or ponyORM or Peewee, because each of them provides a different way of interacting with your data with different tradeoffs. With Django the most reasonable choice is the one-and-only Django ORM.

Same with things like authentication; in Flask you can pick and choose your authentication mechanisms (and choose whether or not to use Flask-Login for the session management, for example), you can choose to use any number of Markdown implementations (there's Flask-Markdown but I personally use Misaka because it works closer to how I need it to), you can choose whether or not to even have an admin interface (not all apps need one, after all), and so on.

For some examples, I built my own website in Flask (well, Publ, which is built on Flask), as well as flrig.beesbuzz.biz/ as a microservice sort of thing. I also used Flask to build a purpose-specific application server for a local apartment building's Internet-driven art installation; that basically only uses Flask as a very simple request routing system (with Jinja for the page rendering, since it's convenient).

Django definitely has its uses, but it's not necessarily that it's what you should use for a larger thing. It's very much a batteries-and-kitchen-sink included framework, and I'm not particularly fond of that sort of one-size-fits-all approach.

Collapse
 
imronlearning profile image
Michael Learns

Right! That makes sense as well! With Flask you kinda have it all in barebones and it's up to you as to what sort of blocks you want to add into it. While with Django it's all in ready for you.

So far with my one week experience with Flask, it's really all barebones. Completely flexible to what you want and need. It doesn't complicate you with the things you don't need but simply provides you with like a launchpad (figuratively speaking) to allow to make something immediately without all the complications.

With Django, it's all ready for you. The routing, the setup, the models, the templates, etc. It has it's own structure already that you don't need to bother with finding the things you may need for your project, because it's all already there.

For me personally, if you're just out there making something small I think that you should start off with Flask. Ofc, you can build something small with Django as well, but why overly complicate building your app by having to deal with Django's built in packages?

When I just started learning about web development I started out with Django and when I saw all these built-in packages that Django had, I had to learn what those do and how to deal with it. Which wasn't much of a pleasant learning experience.

The reason why I wanted to learn Flask was because I wanted to build something immediately, without making it perfect and having to deal with all the built stuff that Django has. If I only needed something, that's what I would get, and that's what Flask has enabled me to do.