SoFunction
Updated on 2024-11-16

Python Django framework design patterns in detail

MVC design pattern

MVC (Model-View-Controller) is a software architecture pattern commonly used in software engineering, which is a design methodology that separates business logic from the display interface. It divides the software system into three basic parts:

M: A business model (Model), which represents an object that stores data.
V: View, which represents the visualization of the data contained in the model.
C: Controller (Controller), which acts on the model in the view, flows data to the model object, and updates the view as it is datamined.

MTV Design Patterns

The MTV pattern in Django is essentially the same as MVC, just defined differently and divided into the following three parts:

M: Model, responsible for interaction and processing with the database.

T: Template, responsible for constructing the html page to be returned.

V: View (View), responsible for receiving requests for business logic, return response

在这里插入图片描述

summarize

That's all for this post, I hope it was helpful and I hope you'll check back for more from me!