A thousand Django's within (or Django multi-tenant)

Lorenzo Peña (~lorenzo)




Django is a popular, solid web framework for perfectionists with deadlines, with a wide ecosystem of packages that extend its powers in multiple directions. In the era of peaking popularity of Node, microservices, and heavyweight browser rendered webapps, Django still remains a triumphant monolith maker, very capable of major undertakings in the web arena.

For all you Django-lovers out there, it seems to me like a matter of time before you have to do some form of multi-tenancy in Django. Taking a solution that works well for one tenant and extending it to multiple tenants should still be a problem for perfectionists with deadlines. Interestingly, when it comes to covering all the many facets of multi-tenancy, Django can be not so batteries included, as one might end up working around or 'hacking' the framework in order to get things done.

In this talk I will walk you through the challenges of bringing multi-tenancy to a Django project. We'll cover the fundamental plumbing required to make it work reliably, securely, and elegantly. You will be expected to have a basic knowledge of Django (models, settings, URL reversing, middleware), and you will learn the working logic behind popular multi-tenancy packages like django-tenant-schemas and django-tenants.


Be familiar with Django: models, settings, URL reversing, middleware, management commands, etc.

Video URL:


Content URLs:

I gave this talk in EuroPython Online 2020 under the title "Yet another package for multi-tenancy in Django", slides for that talk are here. I will be using a different introduction scheme, but the main content section (slide 39 onwards) will be mostly equivalent.

  • Intro: Django and multi-tenancy (7 minutes)
  • Three architectural choices: users, database and tenant routing (10 minutes)
  • The scope of everything else: management commands, file storage, cache, etc. (7 minutes)
  • Outro (3 min)

Speaker Info:

I have been using Django for 11 years, since I fell in love with the framework back in 2009, while I was taking a web development class in college. Now a member of the Django Software Foundation, and co-creator and maintainer of django-pgschemas and django-unmigrate.

Former professor of Logics and Programming at the University of Holguín, Cuba. I currently teach Biblical studies in my local Methodist church.

Speaker Links:

Section: Web development
Type: Talks
Target Audience: Intermediate
Last Updated: