What is Django?
Django (read as, jang-goh) is a framework for web-application development. It is an open source framework written in Python. It makes website development faster, scalable and more secure.
What is a framework?
A token is a single element in programming language such as identifiers, keywords, operators, delimiters, and literals. We make a code statement by using tokens. We then structure our code in reuseable units like function and class. Functions and classes share the namespace of a program file also knwon as module. Modules are stored in folders callled packages. A bundle of these packages makes up a library. So a library is bunch of reuseable code that you may use in program to fill the gaps. A framework is similar to a library in terms of offering set of reuseable code packages.
In real-world conditions a library fills the gaps in your modules. But a framework acts a library inside-out. You fill the gaps in the framework to quickly and seamlessly develop your application.
So now its clear why Django is a framework. But what is a web-application then.
Website vs web-application
A website provides visual and text content which you can view without affecting its functioning. A web-application offers the features like a website and additionally let us interact with its functioning. A web-application usually requires user authentication and authorization.
For example, a website with about us, contact us and gallery pages is merely a website and it gives the same information to every user. On the other hand, web-applications like netbanking page, instagram etc. has more dynamic content rendered to you as per the context of your login information and query.
Django MVT
MVC is a software design pattern that has three components namely Model (back-end), View (front-end) and Controller. Django uses a modified version of MVC called MVT where:
Model is the data storage layer,
Template is the data presentation layer and
View is the logical layer that interacts with Model to fetch and render data to Template.
MVC is a software design pattern that has three components namely Model (back-end), View (front-end) and Controller. Django uses a modified version of MVC called MVT where:
Model is the data storage layer,
Template is the data presentation layer and
View is the logical layer that interacts with Model to fetch and render data to Template.
Request and response cycle in Django
A request starts when the user submits a URL in the web browser. The request is forwarded by middlewares to match a urlpattern. These urls path map to view functions or return error. A view function may take the request further to models to access data or directly render response to a template page.