Django Introduction

0
257

As we have already mentioned earlier that Django is a high-level web framework which is written in Python. And it follows the MVC (Model-View-Controller) pattern. First, we will help you to understand the MVC pattern and then we will move forward towards Django’s MVT (Model-View-Template) pattern.

Also Read: Django tutorial

MVC Pattern
Any application dealing with the user interface usually follows the MVC pattern. The three components of this architecture are: Model, View, and Controller. Check out our tutorial on MVC architecture here.

Django MVC – MVT Pattern
There’s a slight difference between Django’s MVC and MVT pattern. In MVC pattern, the framework itself deals with the Controller part of the application. While in MVT pattern, it leaves the Template part for the developers. Well, Controller is that component of the software which regulates the interaction between the other components, which are Model and View. On the other hand, Template is a file written in HTML and DTL (Django Template Language).

The below-provided diagram will help you to understand the interaction between the various components of the MVT pattern. This interaction occurs in response to a user request.

The task of a developer is to provide a model, a view, and a template. After this, it has to be mapped to a URL. The rest of the process is to be taken care of Django itself.