Knowledge points|MTV model (Model-template-view)

MTV (Model-template-view) pattern is a software architecture pattern in Django, which is similar to the MVC pattern. It divides the software system into three basic parts: Model, Template and View.

As a web framework, Django needs a very convenient method to dynamically generate HTML web pages, so it has the concept of template (T). The template contains part of the code of the required HTML and some special syntax that describes how to dynamically insert the data passed by the view into the HTML web page. View (V) is similar to the integration of controller and view in MVC pattern.

For the MVC mode, see:Knowledge Points | MVC Mode (Model–view–controller)

basic component

  • View(V)
    • Graphical interface display and interaction
    • Receive, parse, and forward requests and results
    • Select the processing model, select the view
  • Template (T)
    • Assist in generating HTML web pages
  • Model(M)
    • Process data, state, and program logic
    • Receive the request and return the processing result
    • Business object and database mapping (ORM)

work process

おすすめ

転載: blog.csdn.net/weixin_73404807/article/details/134290877