An ORM-based backend for Django Tasks
Project description
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
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_tasks_db-0.12.0.tar.gz.
File metadata
- Download URL: django_tasks_db-0.12.0.tar.gz
- Upload date:
- Size: 26.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
314d486b8c1786705b4afaf03dadaf0b1b104163acce9c5d9c9bb2aef205c501
|
|
| MD5 |
8a7f74a2d320686aa1e5c95e5ae58d9d
|
|
| BLAKE2b-256 |
f425bc21ad4a610634f0a66f4faea4522eed26b55dbd50c4ac853128d24091d3
|
Provenance
The following attestation bundles were made for django_tasks_db-0.12.0.tar.gz:
Publisher:
ci.yml on RealOrangeOne/django-tasks-db
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_tasks_db-0.12.0.tar.gz -
Subject digest:
314d486b8c1786705b4afaf03dadaf0b1b104163acce9c5d9c9bb2aef205c501 - Sigstore transparency entry: 924457006
- Sigstore integration time:
-
Permalink:
RealOrangeOne/django-tasks-db@29f923a58aadf8222a77d3e7d67cafd28b3a3f84 -
Branch / Tag:
refs/tags/0.12.0 - Owner: https://github.com/RealOrangeOne
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@29f923a58aadf8222a77d3e7d67cafd28b3a3f84 -
Trigger Event:
push
-
Statement type:
File details
Details for the file django_tasks_db-0.12.0-py3-none-any.whl.
File metadata
- Download URL: django_tasks_db-0.12.0-py3-none-any.whl
- Upload date:
- Size: 28.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69e3a1edcbf1efeeb1268da465e8ea5296ddd80834719769acc719b82da2d62e
|
|
| MD5 |
2d259dd66069f129b7c9268ad3b5cc94
|
|
| BLAKE2b-256 |
091ce14198615e22df28b333540f2e506d6ddef7aff16d510818e94ebc01440c
|
Provenance
The following attestation bundles were made for django_tasks_db-0.12.0-py3-none-any.whl:
Publisher:
ci.yml on RealOrangeOne/django-tasks-db
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_tasks_db-0.12.0-py3-none-any.whl -
Subject digest:
69e3a1edcbf1efeeb1268da465e8ea5296ddd80834719769acc719b82da2d62e - Sigstore transparency entry: 924457016
- Sigstore integration time:
-
Permalink:
RealOrangeOne/django-tasks-db@29f923a58aadf8222a77d3e7d67cafd28b3a3f84 -
Branch / Tag:
refs/tags/0.12.0 - Owner: https://github.com/RealOrangeOne
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@29f923a58aadf8222a77d3e7d67cafd28b3a3f84 -
Trigger Event:
push
-
Statement type: