This is the second blog of my series Everything About Django. You can read my previous article here.
In this article, we are going to learn the core architecture of Django, how Django works.
Django follows the architecture MVT - Model View Template.
Let's break the MVT architecture :
- Model : This is the database layer of the architecture. Model means the tables stored in the database. Django follows the ORM (Object Relational Mapping) Protocol by which we can write the database commands in pythonic way without any SQL. We will study this in detail in coming blog.
- View : This is the logical layer of the architecture. This is where we write the logic of our project. We create functions/classes which are mapped to different URL Patterns of our site (project).
- Template : This is the display layer of the architecture. This contains the html files that are rendered(displayed) on our web interface. Every view(function/class) sends a template or a http response.
- A user opens a specific url of our site (project) suppose http://localhost:8000/login
- Django maps this url to the specific view (function) which implements the logic for this url.
- The view takes the data from associated models (database) and sends a template which is rendered on the web interface.
I hope the MVT architecture of Django is clear. Feel free to comment your doubts.