Choosing between Flask and Django

Rohit Kumar Bhandari
2 min readMar 10, 2021

When you are creating any project for Data Science, Machine Learning, and Artificial Intelligence, you must have got stuck. You are stuck between choosing the framework for python. I am sure that you must be knowing a lot of frameworks for Python. But try to remember the top 2 frameworks you have been working upon. I am sure you are thinking about Flask and Django.

Photo by Jon Tyson on Unsplash

First of all, I would like to appreciate that you have time in studying both of the frameworks. And that is why you have come to this article to search which one to choose.

I am not here to choose between which one is better, but surely I can give the scenarios where you can decide which framework will be better for you.

When a project comes to you related to data science, machine learning, and artificial intelligence, you must have seen that they majorly of two types:

The first one is an API that provides an intelligent response to certain parameters and is based on machine learning algorithms.

The second one is an end-to-end project that lets you create a whole application along with front end, backend, and intelligent machine learning algorithms working behind to provide desired action and workings.

Now talking about the frameworks. If we look at the boilerplates in the Django framework, you will clearly find that there is architecture strictly created to show different views and provide desirable content on them that can be easily be provided from any script of machine learning library or algorithms. This surely provides a great advantage when we need an already built architecture to support our front end, backend and even admin panel is available to support our Database and manage it. These all things and that also on the start of the project.

While if you look into the flask, there are almost zero boilerplates. No templates, no backend connectivity, no architecture or folder structures. Just a function to give the desired output. Just like we want with an API, lightweight and fully functional.

Photo by Markus Winkler on Unsplash

Now there can be arguments that we have libraries in the flask to support templates and database and we can also create architecture on it.

Also, you can say that Django can also provide support for API and very well handle it.

In short, I would say that you can have it anyway. Do what you are best at. But try to make the best of both worlds. Keep Improving.

--

--

Rohit Kumar Bhandari
0 Followers

A Data Scientist with 2 years of experience in content marketing and I.T. industry developing platforms for complex ML based applications.