InterviewSolution
| 1. |
Explain the architecture of Django? |
|
Answer» Django architecture is based on the MVC pattern. MVC architecture solved lots of problem in the traditional approach of web development. Components of MVC pattern are Model, VIEWS, and Control and is a PRODUCT development architecture to solve the drawback of code of traditional approach. 1. Model: Model as a part of the web application, acts as a mediator between website interface and database, in short, it is the object that implements the logic for the application's data domain. Many times application only takes data in particular DATASET, and directly sends data to the view without any database, that dataset is called a model. In Django architecture, the component model contains business logic. Let us see the example of website sign up, when you sign up, you are sending information to the controller which transfers it to models which APPLY business logic on it and stores in the database. 2. View: View component of Django architecture contains UI logic. It is a User Interface of the web application and contains HTML, CSS, and other front-end technologies. Contents for the UI comes from the Models component. When interacting with the specific component, a new Web page that is generated say due to click on any link of the website is the specific views that are stored and generated. 3. Controller: Controller component of the Django architecture is the main control component, that handles user INTERACTION and selects view according to the model. The major task of the controller is according to the user interaction select a view component and applying to the model component. 4. MTV pattern - Django is an MTV (model-Template-View)framework and used template terminology for view and Views for Controller. In the MVC pattern, a template is related to View and is a presentation layer that manages presentation logic and controls how to display and what content to display for the user. |
|