Django Tasks DB
A Django Tasks backend which uses Django's ORM to store tasks in the database.
Installation
python -m pip install django-tasks-db
First, add django_tasks_db to your INSTALLED_APPS:
INSTALLED_APPS = [
# ...
"django_tasks_db",
]
Finally, add it to your TASKS configuration:
TASKS = {
"default": {
"BACKEND": "django_tasks_db.DatabaseBackend",
"QUEUES": ["default"]
}
}
Usage
Worker
You can run the db_worker command to run tasks as they're created. Check the --help for more options.
./manage.py db_worker
In DEBUG, the worker will automatically reload when code is changed (or by using --reload). This is not recommended in production environments as tasks may not be stopped cleanly.
Pruning old tasks
After a while, tasks may start to build up in your database. This can be managed using the prune_db_task_results management command, which deletes completed tasks according to the given retention policy. Check the --help for the available options.
Customizing the task id
By default, the database worker uses uuid.uuid4 to generate a task id. This can be customized using the id_function option:
TASKS = {
"default": {
"BACKEND": "django_tasks_db.DatabaseBackend",
"OPTIONS": {
"id_function": "uuid.uuid7"
}
}
}
The id_function must return a UUID (either uuid.UUID or string representation). Additionally, the PostgreSQL-specific RandomUUID or other database expressions are supported on Django 6.0+.
Contributing
See CONTRIBUTING.md for information on how to contribute.
Note: Prior to 0.12.0, this backend was included in django-tasks. Whilst the commit history was cleaned up, it's still quite messy. Don't look too closely.
Metadata
Release files for django-tasks-db 0.13.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_tasks_db-0.13.0.tar.gz | 29.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_tasks_db-0.13.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 61.6 kB
Release files / django_tasks_db-0.13.0.tar.gz
| Download URL | django_tasks_db-0.13.0.tar.gz |
|---|---|
| Size | 29.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09630d417cf722b07e1439b837403e18e86455908ba532fa6795b0d23dc3ff23
|
|
BLAKE2b-256 checksum How to use checksums |
6ce9fd12dc51bb25c52658bbf329a6f2454b215d063fca8c8342458a474dae16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.
Transparency logRelease files / django_tasks_db-0.13.0-py3-none-any.whl
| Download URL | django_tasks_db-0.13.0-py3-none-any.whl |
|---|---|
| Size | 32.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3a47250b09d40e9b289851d2a550d840d29e59ee3e7115129831e291bb35576
|
|
BLAKE2b-256 checksum How to use checksums |
30d28b10117fca37a2d1f2e45f4878ffa07cf6c0c8df1920e250db30e2228b9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.
Transparency log