Model View Control Architecture (Python Django)
The evolution of web application development and increasingly large group of developers working on a single complex application requires a scalable and easy to manage framework. The Model View Control framework referred as MVC architecture is by far the most widely used pattern for developing complex web applications.
MVC framework is split into three different components Model, View and Controller .Each component has a specific purpose that interact with one another to produce the intended result
A Request-Response cycle in MVC Framework
1.The server passes a request to the controller
2.The controller asks the model for data, based on the request received.The model based on the data logic speaks to the database and performs the requested operation (fetch data/validate/modify/delete etc.)
3.The controller upon receiving the response from the model passes the control to the view for rendering the presentation.
5.The presentation is made available to the end user .
If the model fails to process the request passed by the controller and returns an error instead, the controller speaks to the view to get the corresponding error presentation and passes that to the controller which in turn is rendered to the user.
In an MVC architecture, the model and view never interact directly, all the interaction is done through controller. Having a controller between presentation of data and the logic of data reduces complexity and makes building complex application much easier.