DJANGO vs all — Python REST war

Parthib Deb
5 min readMay 1, 2023

--

Good to see you all here !! so, I am going to discuss on an intimidating topic , going inside every modern web developer’s mind . First of all, let’s understand the context .

Since Python (especially after version 2s), with its slick , short , to the point syntax has started its non-stop demand through out a range of years. But when the story diverts to its web frameworks , we seems to get a great taste of python . Frameworks like Pyramid , Flask , Django and others develops the backend using python’s awesome syntaxes. So, why ‘vs’ ??…python has many frameworks for the web ,but efficiency of all those frameworks are not the same , that’s why you would hear only few names of python frameworks in today’s web dev world comparing to JS frameworks. Now you have to understand , what is a FRAMEWORK in general. so, In simple terms, its a ready-made collections of components to build a good application. That’s where, the conflict comes!!

Since all the frameworks have some basic pre-requisites for database connection (especially to the relational ones) and no other features for the well being of the website like providing security (Which comes through out the evolution in HTTP and www), no other default frontend managing facility , where you can put all your HTML,CSS and other client-side engine codes and can direct map those events with your models in one platform , DJANGO becomes an extraordinary exception !! Django provides a complete FULL STACK PLATFORM ,where you can literary code for client-side and merge them with appropriate server-side logics, obeying the MVT(MODEL-VIEW-TEMPLATE) architecture.

Django Folder Structure for full stack purposes ( Screenshots of my project CODEFACTS)

Django also provides you a built-in admin panel and shell for all CRUD operations. Also ,Django takes very much care of AUTHENTICATION. You can add any third part app inside django’s settings.py (It’s a full stack configuration file) for specific purpose . So, you can see that how django was ahead of its time , when the other backend frameworks were thinking about just making server side rendering by api , django took one step forward to reduce developer’s effort and make applications rapidly.

So, now what’s the situation ?? Fastforward 2021, when creation of FASTAPI happened , it starts to get popularity rapidly as you can see now. Basically it has solved the problem of connecting a python framework to a NOSQL database in a snap and reducing the ammount of code , inspired from flask !! so, that made a question on django developer’s mind — so, is the journey of the party end ? will django be extinct soon?? Before coming to any conclusion, let us understand in what arena of web development we are living now!!

When the popularity of JS frameworks like Vue , Angular , and recently from 2018 , React.js starts to begin , popularity of component based web development started to fire (means you will create your backend logic in a separate framework , maybe of separate language based and frontend also in a separate framework , preferably under the JS giants and via REST API you have to connect them) . Thus it also pushed forward the reputation of Hybrid Web Development . Fastapi is serving this modularity from python-end along with some new features like Type Annotations , built-in API docs . But wait a minute !!…Django already have a popular third party REST API creating app throughout its journey — DjREST (Django REST Framework)

what made django different from others , also makes a clear difference in between DJREST and other REST creation providers . In djrest , you will create an api in a part by part process , means you will create models for databases , write serializer (the way how api formats the data while sending it from user to database or viceversa , the most common format is JSON) logics and map those logics to various HTTP METHODS by View-classes. Yeah!!.. a little stressful it is to make Rest Apis in djrest but you will grab the fundamental processes of how REST API WORKS in reality.

SERIALIZATION logics — FARMERS API project

Although for this current scenario , microframeworks like flask has also started to rise again as from the birth time of django, it’s only focusing on creating REST APIs especially. So what ?….django has a new option — DJ-NINJA (NINJA API)

Though , the reputation of DJREST is still skyhigh for creating strong backend based application , especially with react and flutter (mobile) , Dj-ninja is a very recently born REST provider third party microtool for django which is exactly the same in syntaxes and components like FastAPI. But it has arrived to solve the problems that was facing by fastapi while connecting to django ORM and some other ones.

Django-ninja ( left ) and Fastapi ( right )

Although django had anothe REST provider, testypie , which has no so much popularity in recent days. Else, django has many packadges to connect with other CSS frameworks like tailwind (search on google ‘Django-tailwind’) which pastes your complex logic to beautiful UI and python drivers to connect with NoSQL databases. So, you see evolution of django is constantly happening for which its journey is still ON , thats’s why many indutries(Youtube, spotify etc) use this framework . On the other hand ,frameworks like fast api has created a reason, why you should move to python for finest backend development. For this reason, the winner is everyone and their parent language PYTHON!!

--

--