In this blog, we are going to talk about Django.
Before that, let’s understand what is a web framework and why do we need it?
A web framework is a software tool that helps us develop an application faster and smarter. It eliminates the need to write a lot of repetitive code and saves time.
What Is Django?
Django is a free open source high-level web framework written in python. It has everything which is needed to build a Robust Framework. Django is used by Instagram, Mozilla, Pinterest, and many more companies.
How to Install Django?
In the command prompt, just type:
pip install django
If you want to download a specific version:
pip install django===versionNumber
- Loosely Coupled – Django aims to make each element of its stack independent of the others.
- Fast – Django enables rapid development with a clean and pragmatic design.
- Don’t Repeat Yourself (DRY) – Keep everything simple and concise.
- Tons of Packages – The set of components and libraries provided by Django will help you speed up the entire web development process. It also takes care of user authentication, content administration, site maps, and many more.
- Secure – Django is built on Python, due to which, it reaps the benefit of the widely active Python community. It helps the developers to avoid many common security mistakes, such as SQL injection, cross-site scripting, csrf, and clickjacking. Its user authentication system provides a secure way to manage user accounts and passwords.
- Scalable – Django has the ability to quickly and flexibly switch from small to large scale application projects.
- Versatile – Django is used to build all sorts of things – from content management systems to social networks to scientific computing platforms.
- Admin Interface – Django provides a built-in admin module which can be used to perform CRUD operations on the models.
- ORM – Object-relational mapper is a code library that automates the transfer of data stored in relational databases tables into objects that are more commonly used in application code.
Django follows the MVT pattern.
MVT is a software design pattern. It is a collection of three important components Model View and Template.
Model: The Model helps to handle the database. It is the backend where your database is defined.
Template: The Template handles User Interface part completely
View: The View is used to execute the business logic and interact with a model to carry data and renders a template.
A user sends the request via the browser. Django works as a controller and checks to the available resource in the URL. If URL maps, a view is called.
The view interacts with the model and template, retrieves data from the database via the model, formats it, render a template as a response.
Thanks for reading!