Django framework web development practice: Django view and URL configuration and request methods (2)
編輯:Python
Django view and URL configuration
I. MTV mode
1. Overview
Django's MTV mode is essentially the same as MVC, and it is also to maintain a loosely coupled relationship between components, but the definition is slightly different. Django's MTV is the value:
**M stands for Model: **Responsible for relational mapping (ORM) between business objects and databases.
**T stands for Template: **Responsible for how the page is displayed to the user (html).
V stands for View: responsible for business logic and calling Model and Template when appropriate.
The View component is provided in Django to act as a C-controller in MVC.
2. The main responsibilities of the view
Receive request
Scheduling Model, processing business logic
Response request/forward Template (display data related logic)
Second, the basic development process
1. Create an App and define functions in the view
In the views.py of each App, define a hello function