Logo

dev-resources.site

for different kinds of informations.

What is the Architecture of Django?

Published at
1/12/2025
Categories
webdev
django
architecture
python
Author
varunpenumudi
Categories
4 categories in total
webdev
open
django
open
architecture
open
python
open
Author
13 person written this
varunpenumudi
open
What is the Architecture of Django?

The first time I was asked this question was not when i was learning Django, but after I had learned it and applied for an internship. During the internship, I was asked this question. Unfortunately, I didn't know the answer at that time, but now I do.

Every Django project you create follows an architecture called MVT. The MVT here stands for Mode Template View. These three things are main parts of any Django project. Let's see about them in detail.

Django Architecture Diagram

Model

A model is a class based representation of a table in a database. Django applications use python classes to represent a table in the website database, these classes are called models in django. All the model classes you create in django should inherit from "django.db.models.Model" class. Each model class will have attributes that represents the fields of the database table.

View

The view is the function or class that contains necessary logic to take in a HTTP request coming from the client and send the appropriate HTML, json or some other response back to the user. In Django these views can be class based or function based in Django.

The view takes in the url path, query parameters along with request body sent by the user/client then uses this data to perform CRUD operations if needed, and sends back the responses.

Template

The template in Django is nothing but a HTML file that defines the layout and contains body of webpage along with some other script written in special templating syntax supported by Django.

Using this special templating syntax we can show the dynamic data on the website. This dynamic data is actually given by a Django view to the template and it usually contains the information about models of the Django project.

MVT and MVC?

The MVT architecture used by Django is a slightly different version of another popular architecture called MVC. Here MVC stands for Model View Controller. Here Model, View and Controller stands for

Model: The model here represents the data and business logic. The model handles the data and business logic of the application similar to the model in Django's MVT.
View: The view here is different. It doesn't contain the logic for handling http requests, instead it represents UI elements. So, the view in MVC is more similar to template in MVT
Controller: The Controller in this architecture is responsible for the logic for controlling the requests and user inputs. So controller here is more like view in the MVC

So, this is all you should know about the Django's architecture. If you have any questions feel free to ask them in comments.

django Article's
30 articles in total
Favicon
A Guide to Planning Your API: Code-First VS Design-First Approach
Favicon
Using React as Static Files in a Django Application: Step-by-Step Guide
Favicon
Struggling with Custom Styles in Django_ckeditor_5: My Solution
Favicon
The Core of FastAPI: A Deep Dive into Starlette 🌟🌟🌟
Favicon
Static sites FTW
Favicon
Master Django Admin: A Beginner’s Guide to Managing Your Projects
Favicon
Creating Open Graph Images in Django for Improved Social Media Sharing
Favicon
Not able to connect to PostgreSQL server on Fedora
Favicon
How to upgrade the Python version in a virtual environment
Favicon
Creating a To-do app with HTMX and Django, part 9: active search
Favicon
Learn Django REST Framework Authentication: A Complete Step-by-Step Python Guide
Favicon
Using CSRF Protection with Django and AJAX Requests
Favicon
Introduction to Django Authentication: Understanding the Core Components and Benefits
Favicon
Get Done ✅ : A step-by-step guide in building a Django To Do List
Favicon
Stremlining Development with Daytona
Favicon
npx life@2024 preview: How Missing Flights, Finding Love, and Building Svelte Apps Changed Everything
Favicon
Struggling with Django's HTTPS development server issues? I have written a simple guide to expose your Django project securely using ngrok.
Favicon
Containerizing a Django Web Application: Serving Static Pages with Docker
Favicon
Exposing Your Django Project to the Internet Using Ngrok
Favicon
Django: Find Nearby Users with Coordinates and Radius
Favicon
Integrate Sentry into your Django project
Favicon
Django Authentication Made Easy: A Complete Guide to Registration, Login, and User Management
Favicon
Schedule a call with Twilio and Django
Favicon
What is the Architecture of Django?
Favicon
What is the difference between the extends and include tag in django?
Favicon
Implémentation de vérification de numéro de téléphone dans un projet drf
Favicon
Integrate React into Django Seamlessly with the reactify-django CLI
Favicon
Handling Unmanaged Models in Pytest-Django
Favicon
Mastering Try-Except Blocks in Django: Simplified Python Error Handling
Favicon
Serverless or Server for Django Apps?

Featured ones: