loading...

Flask vs Django in 2020

whiteheadbanger profile image Sebastian ・1 min read

Hi there! I'm a python programmer and recently (a few months) I've been learning and working with Flask, because I heard that it was simpler than Django and I wanted a quick go into the reign of frontend.

Now that I'm more capable, I was wondering, is Django better vs Flask? Or what are the major differences that you like it better above the other?

The intention of the post is for you to give your opinion rather than a literal response to my question. I want to know what you like to do with one, while in the other it's more tedious or weird or whatever adjective!

Discussion

pic
Editor guide
 

I tend to like the simplicity of flask better. Django is a very robust and powerful framework but it also forces you or at least encourages you to use things you may not need.

For example I don't NEED a database for flask. I likely will add one but it doesn't force that on me.

I find flask to be more flexible letting me choose my components and there are cookie cutter recipes that makes all this easier.

The downside of course is, since you're choosing all of your components, it takes a little bit more work to get it in the same state Django.

Basically flask is Django without any opinions it let's you make your own choices and the gives you the ability to shoot yourself in the foot as well.

Obviously this is just my two cents and everybody will have a different opinion but this is my take.

 

Django is great for enterprise projects because it breaks everything up. Which is great for teams. Each discipline has their stuff separated from the other disciplines. But for an individual, it means that you are constantly jumping all over the place. Your templates are here, Views are there, URLs over there, and models elsewhere. In Flask, you could put the whole thing into one file. Not a good idea, but you could. But Django has a turn key admin interface. I generally recommend Flask for individuals, Django for teams.

 

Django is great but add a big chunk of code/complexity to your app even if you will never use it. Some project like CMS, e-commerce and any big web app that required a team work, will work very well in Django.

But for mini app or micro service or any no db or no classic crud app, Django is too much.

I study Django for the last 3 months (see my dev.to review: dev.to/rickavmaniac/django-rails-o... ) and to be honest I am not convince at all.

Going with a Python solution I think Flask will be my choice. With Flask you can build your web app one brick at a time and add more bricks if and only if you need it!

After passing the last 3 months with framework testing, I realize that sometime no framework (or very minimalist like Flask) is the best solution. At the end of the day I pass way too much time adapting my code to framework to and/or dealing with boiler plate code. Instead, I could have invest all this time to just code from scratch something way more flexible, efficient and close too my needs.

 

I started exploring the web dev side and since I am a complete beginner I browsed, read, watched the resources. I don't know python but I know java. I came across many people who recommended me to start with flask and then after getting comfortable you can shift to django if you want.

 

Based on what I have read about both frameworks, if you are a beginner go with flask, if your project is small go with flask, else go with django.. cheers