Skip to content

CLI reference

Who is this for: developers and operators who onboard tenants, migrate their databases or inspect them from a shell.

The library adds three Django management commands. Run them like any other command, with the project's settings:

python manage.py <command> [options]
Command Purpose Page
provision_tenant Create or update a client and its domains, create its database, migrate it, activate it provision_tenant
migrate_tenants Run migrations on every tenant database, or on chosen ones migrate_tenants
tenant_shell Open a Django shell with a tenant active tenant_shell

All three also accept Django's standard options (--settings, --pythonpath, --verbosity, --traceback, --no-color, --force-color, --skip-checks).

Plain migrate still manages the shared database: run it first on every deployment, then migrate_tenants.

python manage.py migrate            # shared database
python manage.py migrate_tenants    # every active tenant database

Next steps

Onboard a first tenant with provision_tenant.