Celery integration for django-tenant-schemas and django-tenants. Automatically sets the schema on Celery task invocations so that tasks run in the correct tenant context. Current version is 4.0.3, supporting Python >=3.9. Release cadence is irregular, with major versions aligned with Django or Celery breaking changes.
pip install tenant-schemas-celeryVerified import paths — ran on the pinned version, not inferred.
Create a Celery app instance that automatically manages tenant schema context. Replace 'your_project' with your Django project name.
Upgrade to 4.0.0+ and use django-tenants instead of django-tenant-schemas.
Use app.Task to inherit tenant schema support in custom tasks, or set app.Task = YourCustomTask in CeleryApp.
Replace with `from tenant_schemas_celery.app import CeleryApp`.
Ensure tasks are called from within a tenant context (e.g., inside a view or with `tenant_context()`) or manually set the schema.
Set `CELERY_BEAT_SCHEDULER = 'tenant_schemas_celery.schedulers.TenantAwareScheduler'` in Django settings.