Django: What, Why, When ?

Tags: python, django, webdev, beginners
Published: 2020-07-13 14:37:24

In this article will take a look at Django-"The Web framework for perfectionists with deadlines". We will outline some of its feature and discuss why using Django is a good choice. We will also point out when to use django and when not to. 

# What is Django?

Django is an open source web application framework written in Python that encourages rapid development and pragmatic, clean design. It follows the "batteries-included" philosophy, meaning that Django comes with common functionality for building web applications, reducing much of the hassle of Web development.

Django supports the Model-View-Template (MVT) pattern, which is slightly different from Model-View-Controller (MVC) pattern. In MVT pattern:
- Model is a data access layer that helps to handle database. 
- View executes the business logic and interact with a model to carry data and render the appropriate template.
-  Template is a presentation layer that defines how something should be displayed on a Web page . 

![MVT](https://dev-to-uploads.s3.amazonaws.com/i/d85c2zuye6xw3odavxt0.png)

# Why use Django ?

### It is Fast
Django is ridiculously fast and helps to turn your idea into product in no time. It follows DRY philosophy, which means we can reuse existing code, thus no unnecessary duplication.

### It is Secure
Security is a high priority for Django and helps developers avoid many common security mistakes including SQL injection, cross-site scripting, cross-site request forgery and clickjacking.

### It is Scalable
Some of the busiest sites on the Web leverage Django’s ability to quickly and flexibly scale.Some examples of websites that are running on Django are:
- Instagram
- Disqus
- Bitbucket
- Spotify

### It is Versatile
Django can be used to build almost any type of website, from simple website to high-end web application. Django is used to build all sorts of things — from content management systems to social networks to scientific computing platforms.
It is compatible with most major databases and allows using a database that is more suitable in a particular project.

# When use Django?
Choosing a framework for your project depends on a lot of factors. It is better to make an informed choice before you start rather than regret it halfway. Selecting an appropriate framework depends on type of project and  desired outcomes.

Some of the situations when Django is a good choice:
- building a highly customizable app, such as a social media website.
- when security is a top priority.
- your app might scale up/down at any point of time.
- building apps that are entirely back-end.

Just because you can use Django to develop almost any type of website doesn't mean you should always use them. Django is not the best option when building a basic web applications as it’s a heavy framework with a lot of features. Micro framework, such as Flask works better in such situations.



# Getting started with Django
Congratulations, now you have a basic understanding about Django and its use cases.
Here is a great article from @wsvincent to get started.
{% link https://dev.to/learndjango/how-to-learn-django-2020-3g45 %}