Which architectural pattern does Django use ?

In This blog, we are going to learn, which type of pattern does Django use. Which architectural pattern does Django use ?

Django uses the MVT(Model View Template) architecture which is based on the MVC( Model View Controller) architecture Major difference between these two is that Django itself handle the controller part.

Fig: ModelViewTemplate Architure

let us know, what is MVT in Details, MVT stands for Model View Template.

What are Models?

Models are a single and definitive source for information about your data.Model is the part of the web-app which acts as a mediator between the website interface and the database.model is a subclass of django.db.models.Model and each field of the model class represents a database field (column).

What are ‘views’?

Views serve the purpose of encapsulation.view is a place where we put our business logic of the application. The view is a python function which is used to perform some business logic and return a response to the user.Response can be the HTML document of a Web page, or a redirect, or a 404 error.

All the view function are created inside the views.py file of an Django app.

What are ‘templates’?

Django’s template layer renders the information to be presented to the user in a designer-friendly format. It consists of static parts of the desired HTML output.

First, create a directory templates inside the project app , and put all HTML files inside templates folder.

“Your project App” -> ‘templates’ -> index.html

Which architectural pattern does Django use ?

Thank you for following this blog.