MTV and MVC model


MVC and MTV Model


MVC is to divide web application into three layers: model (V), controller (c) and view (V); They are connected in a plug-in, loosely coupled way.


Object (ORM) responsible for business object and database


Responsible for interaction with users (page)

C: Contonnar controller (routing distribution URLs. Py)

Accept the user’s input, call the model and view to complete the user’s request

In essence, MTV is also MVC



Django’s MTV pattern is essentially the same as MVC pattern. In order to maintain the loose coupling relationship between components, there are only a few differences in definition. Django’s MTV represents:


Object (ORM) responsible for business object and database


Responsible for how to display the page to users


Responsible for business logic, and call model and template when appropriate

In addition, Django also has a URL distributor, which is used to distribute the page requests of each URL to different views for processing, and then the view calls the corresponding model and template