DEV Community

Cover image for Django: What, Why, When ?
Biplov
Biplov

Posted on

Django: What, Why, When ?

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

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.

Top comments (1)

Collapse
 
jodaut profile image
José David Ureña Torres

Great post. I'd like to add that Django is also a good choice for RESTful API's with Django Rest Framework.