The State of Django in 2020

Django has been around for 13 years, and I’ve been using it since the beginning. In 2020, is Django still relevant and useful? Let’s take a look.

Introduction to Django

Django is known as “the web framework for perfectionists with deadlines”. It is written in Python and can be considered a “batteries-included” framework. With some other frameworks you have to choose your own ORM, template renderer, caching system, and so on. Django has these all built in so you can get up and running quickly.

Django Logo
Django Logo

However Django is still flexible enough that, if you want to, you can swap out these parts. It is possible to replace Django’s ORM with SQLAlchemy for example. Or you can drop in a different template renderer like Jinja.

If you want to, you can forgo the template rendering all together and just use Django as a REST backend. Django Rest Framework makes this simple. Just pair with your favourite JavaScript framework, and you’re off.

If I’m building a super-basic site that needs to render a couple of templates and perhaps collect very little form information, I’d probably use Flask. Anything more advanced than that and I don’t hesitate to start with Django.

Big sites using Django

Whenever a framework or technology is evaluated, the questions that are always asked are “who else is using it?” and “does it scale?”. While the latter probably depends more upon how your app is designed and which caches, databases and “hardware” you’re using, it’s good to be able to point to a number of sites successfully running Django at a large scale.

The Django Project website maintains a list:

And if that list isn’t enough to convince you, I can also reveal to you now that TeraShift.co.nz is also running on Django (shocking, I know!)

Is Django actively maintained?

Even though Django has been around for quite some time, it is still being actively developed. At the time of writing, the latest version is 3.0.8 which was released earlier this month. The latest release candidate for version 3.1 is only a week old.

The latest major version, Django 3, is the beginning of support for Asynchronous Server Gateway Interface or ASGI. This is a replacement for the older Web Server Gateway Interface (WSGI). ASGI uses Python 3’s asyncio to provide non-blocking servers. This is similar to how NodeJS works. While not fully async capable yet, the Django developers are making the move in that direction.

Using async will allow for huge performance gains with network bound workloads, as the overhead that comes with thread switching is removed. Therefore you should see the biggest benefits with JavaScript frontends that make a lot of small requests, or that use websockets.

This is the biggest change, but others are listed on the Django 3.0 release page. In short, this shows that Django is still being actively developed and new features are being added.

Third party extensions

Django has a rich library of extensions than can be easily dropped in to enhance an existing project. Here’s some that I’ve found useful.

  • Django Configurations: use classes to implement inheritance in your Django settings as well as define them with environment variables.
  • Django Crispy Forms: Define your entire form in Python code, instead of having to write <form> markup and submit buttons in HTML. It also supports a number of CSS frameworks (like Bootstrap and Foundation) and can automatically render forms with the right CSS classes to support these.
  • Django Allauth: Easily add the ability to log into your Django site with a Google/FaceBook/Github/Twitter/etc etc account.

Solution Plugin
This is the cheesiest image I could find representing a problem being solved by a plugin.

There are of course many more third party libraries, and you’re likely to find that someone has made one to fit your needs. These are just three that I find useful across a range of different projects.

Python deployment

When it comes to ease of deployment, PHP is definitely the champion there. Just drop your PHP files onto a server and you’re done.

Deploying Django, or any Python project, is definitely a more difficult process. From virtual machines, to containerisation, to lambdas, at Tera Shift we’ve worked with them all.

Server Rack
Python deployment is done in many ways, but it can be difficult.

But, we’re also working on a way to bridge that gap and make it just as easy to deploy a Python application as it is static HTML. Subscribe to our email list below to be notified of updates to this project.

Python and Django development

We’ve worked with Django for over 13 years, before it was even version 1.0!

Whether you’re building something new or just need maintenance on an existing site, Tera Shift has the experience to make your project a success. Please contact us to find out how we can help.

Conclusion

Django is definitely still relevant in 2020 and continues to make building complex websites quick and simple.

Its flexibility means you can use it to render templates and generate HTML, or as a REST backend for a JavaScript frontend, or for anything in between.

About Tera Shift

Tera Shift Ltd is a software and data consultancy. We help companies with solutions for development, data services, analytics, project management, and more. Our services include:

  • Working with companies to build best-practice teams
  • System design and implementation
  • Data management, sourcing, ETL and storage
  • Bespoke development
  • Process automation

We can also advise on how custom solutions can help your business grow, by using your data in ways you hadn’t thought possible.

About the author

Ben Shaw (B. Eng) is the Director of Tera Shift Ltd. He has over 15 years’ experience in Software Engineering, across a range of industries. He has consulted for companies ranging in size from startups to major enterprises, including some of New Zealand’s largest household names.

Email ben@terashift.co.nz