Model Template View

Hello everyone,

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:

  1. What is the Model in Django?
  2. What are URLs and Views?
  3. How these things are connected?

What is the Model?

Django is basically a framework for websites and this framework having 3 things

  1. python code
  2. Database
  3. Template

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,

MTV

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