Skip to content

Middleware

The core of django-tenants-url is the custom MIDDLEWARE.

Table of Contents



Installation

  1. Add the TENANT_USER_MODEL to settings.py.
# settings.py

...

DTU_TENANT_USER_MODEL = 'myapp.TenantUser'

...
  1. Update the MIDDLEWARE to have the new RequestUUIDTenantMiddleware. Preferentially at the very top.
# settings.py

...

MIDDLEWARE = [
  'django_tenants_url.middleware.RequestUUIDTenantMiddleware',
  'django.middleware.security.SecurityMiddleware',
  ...
]

...