Conteúdo do Curso
Django: Build Your First Website
Django: Build Your First Website
MVT
Model View Template
The MVT (Model View Template) is a software design pattern. It is a collection of three important components Model, View, and Template:
-
Model: The Model represents the data of your web application. It's like a container that holds information. For example, if you have a website about books, the Model would hold details such as the book's title, author, and publication date;
-
View: The View is like a middleman between the Model and the user. It takes the data from the Model and decides how to present it to the user. It's responsible for showing the information in a way that makes sense. For instance, the View would take the book's details from the Model and display them nicely on a webpage;
-
Template: The Template is all about the visual part of your web application. It's like a blueprint or a design for how the webpage should look. The Template works together with the View to take the data from the Model and put it in the right places on the webpage.
The user sends an HTTP request to a specific URL. The server receives this request and processes it by retrieving the HTML template, which serves as the page's display in the browser, and data from the model. The server returns an HTTP response to the user, passing the data from the model (+ any additional data) and the template for rendering, which serves as the interface for the user.
Obrigado pelo seu feedback!