Django is a free open-source web application framework written in Python. It has a very long nickname.
Open-source is code that is designed to be publicly and freely accessible. It means that anyone can modify, and manipulate the code as they see fit.
Framework literally means work to make 'frame' of website. Developing a web application requires lots of work such as coding, designing, and testing. For only the coding part, programmers had to take care of the syntax, declarations, garbage collection, statements, exceptions, and more.
Frameworks help developers on making a web by taking control of most web development processes like making a sign-in page, forum, and authentication.
There are lots of advantages of using a framework. It helps to make consistent developing code with fewer bugs. Testing and debugging the code is a lot easier and the code becomes more secure. Several code segments and functionalities are pre-built and pre-tested, so this makes applications more reliable.
Django architecture based on MVC pattern.
MVC pattern has three main components which are called Model, View, and Controller.
Model : Model is a mediator between the website interface and the database. The model represents how data is organized in the database.
View : The view is what you see when you visit a site. The view contains all the information that will be eventually sent to the client.
Controller : Controller controls the flow of information. The controller is the center of the MVC pattern, because it acts as a glue between models and views. Also, it connects users and data on the web by controlling models and views.
There's an example to show how MVC pattern works in Django.
- Client or user request information to the web server.
- The request received by the server is passed to the controller.
- The controller asks the model to get information.
- The model sends the information to the controller.
- The controller then passes the data to the view.
- The view shows the data on the screen and user sees the information.