Flask vs Django As a Full Stack Python Developer - Reading Time: 3 Mins

Introduction

I find that one of the things about doing web development in Python is that you have to make a choice between Flask and Django. Battlelines would be drawn for this from the perspective from either side for multiple full stack python developers.

At one side you have a school of thought to build a web application for simplicity, flexibility & from the ground up with just the meat and not the fat which belongs to Flask.

The alternative is ready to go with what you need from day one with an ecosystem like Django packages. As you go along to refine and make it work without much of your effort in coding from scratch that is in the same realm of Ruby on Rails aspect.

What is the Learning Curve?

I think for anyone starting out this will be one of their core questions in learning either Flask or Django. My take is to focus on just one and run with it based upon the use cases on what do you plan to do.

I agree that Django has a huge learning curve because of software engineering best practices that are baked in. From well-known concepts from the ground up like 3 tier architecture and ORM (Object Relationship Mapping).

Which coming from a software engineering background makes it easier for me to understand and why I should use it.

Flask is easy to get started by just copying examples to get started. With it comes with multiple ways to create APIs, hookup with a database, project structure, templating. This can be frustrating to search for solutions, python packages or examples to solve your problem.

In fact, Flask is one of my choice of technology, if I were ever to go for a hackathon again besides Startup Weekend. To build things fast with pre-built examples to get started by MacGyvering my way to get it out for my presentation the next day.

How is It Use?

If you need something fast and easy to get started. Plus you want to learn tons of front-end technologies & you would like to build a website from the ground up.

Flask shines when you are doing something simple. The cost comes with headaches in structuring your project, choosing a database, ways to build an API yes there's literally tons of way to skin a cat with this.

Django is used when you had a straight forward use case with everything outside the box. Like building a website, e-commerce, marketplace, a highly secure website, membership website, CRM or web application with a great admin panel for multitenancy build to support different users or an API backend.

What are the Types of Jobs?

It could differ from job to job-based upon, on my understanding Flask is the prefered choice for Data Science or Microservices work due to its flexibility and simplicity of use.

Whereas Django is usually treated as an API backend that does the heavy lifting for web application development with security & scale as a high priority. Due to the recent release of Django 3.0 that takes advantage of ASGI to provide asynchronous services like Websockets and Graphene that provides GraphQL APIs.

The trifecta of highly sought after skills that are gaining popularity for Django developers which is React, GraphQL & Django. This may be pair further with either AWS, Google Cloud, Microsoft Azure or Docker plus Kubernetes to deal with deployment.

Conclusion

I hope this article might be useful for Full Stack Python developers. For me, my choices have always been based upon use cases and what is the purpose of the building.

I treat Django and Flask as part of my toolbox to accomplish different purposes depending on the type of work that I'm required to work on.

For me to anyone starting out to get the best bang for the buck is to go for Django due to it's outside the box purposes in building a web application.

Reference