we know In Django framework we used MTV instate of MVC (Model View and Control) so today's blog is all about MTV architecture and we will roll to its actual working in Django framework, So let’s jump right into it
Points that I will cover in this blog are:
- What is the Model in Django?
- What are URLs and Views?
- How these things are connected?
What is the Model?
Django is basically a framework for websites and this framework having 3 things
- python code
on client-side request comes to server this server is basically interpreter with Django framework and sent the template to client
so here the main database part is nothing but the models
Models are the main python file which handles database (modle.py)
What are the URLs and Views? and How these things are connected?
so we know that to respond to client Django sends template that template are Views
and when a client requests a particular URL that handled by URLs, which does two things,
First is to look at the request URL(urls.py) and
second is to which function would fire in views.py
so to answer this,
browser — >>request to about — ->urls.py(looked at the request and decide for template) — >>views.py (send template)— >>response — >browser
So here in MTV
Models are database →handles database
The template is views.py →respond to browser
Views are urls.py →controls request and decide for respond
so this blog is all about MTV Architecture which I wanted to share with you guys in very simple language I hope you understand this concept let me know your feedback till then read read