Introduction to Django

Table of contents
Reading Time: 3 minutes

Python_logo_and_wordmark.svg

In this blog, we are going to talk about Django.

Before that let’s understand what is web framework and why do we need it?

A web framework is a software tool that helps us develop 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

Why Django?
  • 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 web 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 project.
  • 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.

orms-bridge

Django Architecture

mvt

Django follows 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 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 URL. If URL maps, a view is called.

The view interacts with model and template, retrieves data from the database via the model, formats it, render a template as a response.

Thanks for reading!

 


Knoldus-blog-footer-image

 

Written by 

Jyoti Sachdeva is a software consultant with more than 6 months of experience. She likes to keep up with the trending technologies. She is familiar with languages such as C,C++,Java,Scala and is currentky working on akka,akka http and scala. Her hobbies include watching tv series and movies, reading novels and dancing.