I. MVC framework and MTV framework
MVC, the full name of the model View Controller, is a software architecture model in software engineering that divides a software system into three basic parts:
Models, views, and controllers (Controller) have the advantages of low coupling, high reusability, and low life cycle cost.
The essence of MVC is to organize code in a way that separates business logic, data, and interfaces, and aggregates business logic into a single component,
There is no need to rewrite business logic while improving and customizing the interface and user interaction.
Want to learn more about the MVC pattern? >> Talk about MVC patterns
The Django Framework's MTV model is essentially no different from the MVC framework, and is divided into three parts to reduce the coupling between the various parts.
The Django framework differs in that it splits three parts: model, template, and view, which is the MTV framework.
Django's MTV Model
Model: Object that is responsible for business objects and databases (ORM)
Template (Template): Responsible for how to display the page to the user
View: Responsible for business logic, and call model and template when appropriate
In addition, Django has a URL dispatcher that distributes page requests for URLs to different view processes, and the view calls the corresponding model and template
Django Framework Diagram
APP
A Django project can be divided into a number of apps that isolate the code for different function modules.
Command line creation
Python manage.py Startapp app01# The names of various apps
Create with Pycharm
Click here for more information
In the command window that pops up below, enter:
Startapp APP01
Routing system
Django Routing system >> point I later update
View System
Django View system >> point me
Template
Templates (template) system >> points I follow update
Model
Model system ORM >> dot Me
Python3 Development of Advanced-django framework