Django Tutorial for Beginners: Features, Architecture & History

Django Tutorial Summary

This Django tutorial covers all the basics topics from scratch. In this tutorial, you will learn the concepts like what is Django, Django history, Django features, Characteristics of Django framework, Component of Django, Advantages and disadvantages, and much more.
Before learning Django, let’s understand:

What is a Web Framework?

A web framework is a code library which helps you to build a flexible, scalable, and maintainable; dynamic website, web app, and web services. Different web frameworks are Zend for PHP, Ruby on Rails for Ruby, etc.

What is Django?

Django is a web development framework for Python which offers standard methods for fast and effective website development. The primary goal of this high-level web framework is to create complex database-driven websites. It helps you to build and maintain quality web applications. It enables you to make the development process smooth and time-saving for rapid development.

Why Django? Key Advantages of Django

Here are the main advantages of Django:

  • Django is easy to set up and run. It offers a variety of options to get started
  • It provides a ready-to-use user interface for administrative activities
  • It enables multilingual websites by using its built-in internationalization system
  • Helps you to meet the massive traffic demands quickly
  • Django is used to build all types of content management systems, social networks as well as scientific computing platforms.
  • Django helps you to provide end-to-end application testing
  • Helps you to document your API with an HTML output
  • REST Framework has rich support for several authentication protocols
  • Permissions and throttling policies
  • It is widely used for rate limiting API requests from a single user.

History of Django

Year Milestone
2003 The project was started by Adian Holovaty and Simon Willison as an internal project at Lawrence Journal-World newspaper
July 2005 It was released In July 2005 as “Django,” named after the jazz guitarist Django Reinhard
June 2008 Declared that a Django Software Foundation (DSF) would maintain Django.
29 July 2009 Django 1.1 version was released with features like Aggregates, transaction-based tests.
17 May 2010 Django 1.2 version was released. The update offered features like multiple databases, Implementation of email backend and improvements for sessions and cookie are made in this version.
23 Mar 2011 1.3 version with features like Class-based views, static files were introduced
23 Mar 2012 1.4 version launched with new features like timezones and in-browser testing
26 Feb 2013 1.5 version comes with Python 3 Support, configurable user model features.
6 Nov 2013 1.6 version comes with DB transaction management, connection pooling features.
2 Sep 2014 1.7 version had new features like application load, migrations, and configuration
1 Apr 2015 native support provided for multiple template engines.
1 Dec 2015 In 1.9 version, automatic password validation feature was introduced.
1 Aug 2016 In 1.10 version full-text search for PostgreSQL launched.
4 Apr 2017 1.11 version becomes the last version to support Python 2.7
2 Dec 2017 version 2.0 becomes first python 3- only release version.
1 Aug 2018 version 2.1 comes with Model “view” permission support feature.
2021 Removed support for Django 3.0 and Added Django 3.2 support

Now in this Django for beginners tutorial, let’s learn about features of Django.

Features of Django

Below are the features of Django:

  • Helps you to define patterns for the URLs in your application
  • Simple but powerful URL system
  • Built-in authentication system
  • Object-oriented programming language database which offers best in class data storage and retrieval
  • Automatic admin interface feature allows the functionality of adding, editing and deleting items. You can customize the admin panel as per your need.
  • Cache framework comes with multiple cache mechanisms.

Now in this Django framework tutorial, we will learn about characteristics of Django.

Characteristics of Django

Here are the main characteristics of Django:

  • Loosely Coupled- Django helps you to make each element of its stack independent of the others.
  • Less code- Ensures effective development
  • Not repeated- Everything should be developed in precisely one place instead of repeating it again
  • Fast development- Django’s offers fast and reliable application development.
  • Consistent design- Django maintains a clean design and makes it easy to follow the best web development practices.

Next in this Django beginner tutorial, we will learn about the architecture of Django.

Django Architecture: MVC and MVT

Below is a detailed architecture of Django:

Django Architecture
Django Architecture

MVC Pattern

When talking about applications which provide UI (web or desktop), we usually talk about MVC architecture. MVC pattern is based on Model, View, and Controller.

The Model defines the data structure and takes to care for querying the database.

The View defines what data should be presented and returns an HTTP response.

The Controller is that part of the application that handles the user interaction.

Django MVC-MVT pattern

The Model-View-Template (MVT) is a different concept compared to MVC. The main difference between these two architectural patterns is that Django itself manages the Controller part (software code that controls the interactions between the Model and View). The template is an HTML file which mixed with Django Template Language file which also called DTL.

The below-given diagram shows how all the components of the MVT pattern interact with each other to serve specific to a user request.

Django Architecture: MVC and MVT

MVT Architecture

As seen in above diagram, a user requests for a resource to Django. Django acts as a controller and checks to the available resource in URL.

If URL maps, a view is called which interacts with model and template. Django then responds to the user and sends a template as a response.

Now in this Django tutorials for beginners series, we will learn about components of Django.

Components of Django

Form

Django has a powerful form library which handles rendering forms as HTML. The library helps in validating submitted data and converting it to Python types.

Authentication

It handles user accounts, groups, cookie-based user sessions, etc.

Admin

It reads metadata in your models to provide a robust interface which can be used to manage content on your site.

Internationalization

Django provides support for translating text into various languages, locale-specific formatting of dates, times, numbers, and timezones.

Security

Django provides safeguard against the following attacks:

  • Cross-Site Request Forgery (CSRF)
  • Cross-site scripting
  • SQL injection
  • Clickjacking
  • Remote code execution

Famous Companies Using Django

Here, are companies which are using Django:

  • BitBucket
  • DISQUS
  • NASA
  • PBS (Public Broadcasting Service)
  • Pinterest
  • Instagram
  • Mozilla
  • The Washington Post
  • NY Times
  • LA Times
  • The Guardian National Geographic
  • Discovery Channel

Disadvantages of using Django

  • A process cannot handle multiple requests simultaneously.
  • Django is a very much monolithic tool.
  • Components get deployed together which can create confusion.
  • Knowledge of full system needed to work on Django
  • Makes web application components tightly-coupled
  • You need to do lengthy programming for minor tasks.

Summary

  • Django is a web development framework for Python which offers a standard method for fast and effective website development.
  • Django started was by Adian Holovaty and Simon Willison as an internal project at Lawrence Journal-World newspaper in 2003
  • Django helps you to document your API with an HTML output.
  • Django allows you to customize the admin panel as per your need.
  • Django helps you to make each element of its stack independent of the others.
  • The main difference between MVC and MVT architectural patterns is that Django itself manages the Controller part.
  • Essential components of Django’s architecture are: Form, Authentication, Admin, Internationalization, Security.
  • Bitbucket, DISQUS, Nasa, Pinterest, Instagram, Mozilla, etc. use Django
  • The biggest drawback of Django is that it can’t handle multiple requests simultaneously.