Configuration¶
Everything django-absurd reads lives under Django's
TASKS setting. A minimal setup:
TASKS = {
"default": {
"BACKEND": "django_absurd.backends.AbsurdBackend",
"QUEUES": ["default"], # optional
"OPTIONS": { # optional
"DATABASE": "default",
},
},
}
Declaring queues¶
You declare queues in one place — never both:
QUEUES (list) — just the names. Use this when queues need no special policy.
OPTIONS["QUEUES"] (map) — names → per-queue policy
(absurd_sdk.CreateQueueOptions).
Use this to set retention
(cleanup_ttl / cleanup_limit).
Note
Setting both the top-level QUEUES list and OPTIONS["QUEUES"] is a
configuration error (absurd.E002). Undeclared queue names are rejected, never
silently created.
Partitioned storage is experimental
storage_mode="partitioned" is declarable but not tested yet, and its partition
lifecycle isn't automated — don't rely on it in production.
Backend OPTIONS¶
All optional:
| Option | Default | What it does |
|---|---|---|
DATABASE |
"default" |
Which DATABASES alias to use. |
DEFAULT_MAX_ATTEMPTS |
5 |
Retry ceiling per task; must be an integer >= 1 (override per task/call — see Tasks). |
QUEUES |
— | Map of queue name → policy (above). Mutually exclusive with the top-level list. |
CLEANUP |
— | Map {"schedule": "<cron>"} to run cleanup on cadence (beat: in-process; pg_cron: native job). Omit to skip. See Cleanup. |
SCHEDULE |
— | Recurring task schedules (beat or pg_cron). See Cron Jobs. |
SYNC_SCHEDULES_ON_MIGRATE |
True |
(pg_cron) Reconcile SCHEDULE into pg_cron on migrate. See Cron Jobs. |
SYNC_SCHEDULES_ON_TEST_DB |
False |
(pg_cron) Allow that migrate-time sync on a test database. See Cron Jobs. |
ENABLE_ADMIN |
True |
Register the read-only Absurd models in the Django admin. |
ADMIN_SITE |
("django.contrib.admin.site",) |
Dotted paths to the AdminSite(s) to register on. |
Non-default database¶
Only when DATABASE points at an alias other than "default", also register the router
so django-absurd's schema and queries route there
(multi-DB routers):
Validate it¶
python manage.py check django_absurd verifies the configuration and points at anything
wrong. Fix what it reports rather than silencing it:
| ID | Means |
|---|---|
absurd.E001 |
Backend / database misconfiguration. |
absurd.E002 |
QUEUES declared in both the top level and OPTIONS. |
absurd.E003 |
Invalid per-queue policy options. |
absurd.E004 |
More than one Absurd backend is configured. django-absurd supports exactly one Absurd backend per project. |
absurd.E005 |
AbsurdRouter missing from DATABASE_ROUTERS. |
absurd.E006 |
ENABLE_ADMIN isn't a bool, or ADMIN_SITE doesn't resolve to AdminSites. |
absurd.E007 |
Invalid SCHEDULE entry (see Cron Jobs). |
absurd.E009 |
OPTIONS["DEFAULT_MAX_ATTEMPTS"] is not an integer >= 1. |
absurd.E010 |
Invalid CLEANUP configuration (not a {"schedule": …} map, or unknown keys; cron grammar checked for beat, at sync for pg_cron) (see Cleanup). |
absurd.W002 |
(Warning) A queue's declared storage_mode differs from the database; storage_mode is immutable once the queue exists. |
absurd.W003 |
(Warning) django_absurd.pg_cron is ordered before django_absurd in INSTALLED_APPS (see Cron Jobs). |