MVT Architecture Of Django
The MVT (Model View Template) is a software design pattern. It is a collection of three important components Model, View, and Template.
- The data guys and gals needed a common interface to be able to work with disparate data sources, formats, and database software
Models are like a set of tools that make working with data and databases much easier
- The hard-core coders needed a framework that allowed them to rapidly deploy changes within the system that kept everyone happy
Views is like a framework that handles communication between the user and the database and automates many of the painful parts of managing a complex website
- The design teams needed to be able to manage the user experience with the tools they already had (HTML, CSS, JavaScript etc.)
Template in django is like a plain-text templating system that can be used by non-programmers
Precisely,
Model: Model is going to act as the interface of your data. It is responsible for maintaining data. It is the logical data structure behind the entire application and is represented by a database (generally relational databases such as MySql, Postgres).
View: The View is the user interface — what you see in your browser when you render a website. It is represented by HTML/CSS/Javascript and Jinja files.
Template: A template consists of static parts of the desired HTML output as well as some special syntax describing how dynamic content will be inserted.
See the following graph that shows the MVT based control flow.
Here, a user requests for a resource to the Django, Django works as a controller and check to the available resource in URL.
If URL maps, a view is called that interact with model and template, it renders a template.
Django responds back to the user and sends a template as a response.
So, there is no separate controller and complete application is based on Model View and Template. That’s why it is called MVT application.
The developer provides the Model, the view and the template then just maps it to a URL and Django does the magic to serve it to the user..
Also Read..