django_dramatiq_pg
dramatiq-pg integration for django.
Installation
Install with pip
$ pip install django-dramatiq-pgAdd to your INSTALLED_APPS list in settings.py
INSTALLED_APPS = [ ... 'django_dramatiq_pg', ]Create a Registry, and register your tasks
from django_dramatiq_pg.registry import Registry tasks = Registry() @tasks.actor def mytask(): ...Configure
DRAMATIQ_BROKER = { "OPTIONS": { "url": "postgres:///mydb", }, "MIDDLEWARE": [ "dramatiq.middleware.TimeLimit", "dramatiq.middleware.Callbacks", "dramatiq.middleware.Retries", ], } DRAMATIQ_REGISTRY = 'myapp.registry.tasks'Start the worker process:
$ dramatiq django_dramatiq_pg.worker
This worker module will auto-discover any module called ‘actors’ in INSTALLED_APPS.
Registry
In a typical dramatiq application, the Broker is configured before any tasks are registered. However, as Django is in control of the intialisation sequence, there is an issue of ordering; the actor decorator assumes the broker is already configured.
To resolve this, django_dramatiq_pg provides a Registry for your tasks, which is then bound to the Broker when Django initialises.
In your code, declare a Registry instance, and use its .actor method to decorate your task functions. Then tell django_dramatiq_pg to use your registry with the DRAMATIQ_REGISTRY setting.
If you do not specify one, django_dramatiq_pg will create one on start.
The registry can be accessed as the .registry attribute on the django_dramatiq_pg App instance.
Settings
- DRAMATIQ_BROKER
A dict of options to pass when instantiating the broker.
- DRAMATIC_BROKER[‘OPTIONS’]
Arguments to pass to the Broker.
- DRAMATIC_BROKER[‘MIDDLEWARE’]
A list of middleware classes to be passed to the broker.
These can either be import strings, or instances.
- DRAMATIQ_ENCODER
Default: None
Import path for encoder class.
- DRAMATIQ_ACTORS_MODULE
Default: ‘actors’
Name of module use to auto-discover actors in INSTALLED_APPS.
DRAMATIQ_REGISTRY
Import path for the task Registry instance.
This should refer to an instance of django_dramatiq_pg.registry.Registry.
This resolves the chicken/egg problem of declaring tasks before the broker is configured.
Metadata
Release files for django-dramatiq-pg 1.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-dramatiq-pg-1.3.2.tar.gz | 7.2 kB | Without provenance | Details for django-dramatiq-pg-1.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_dramatiq_pg-1.3.2-py3-none-any.whl | Python 3 | none | any | Details for django_dramatiq_pg-1.3.2-py3-none-any.whl |
Total release size: 14.7 kB
Release files / django-dramatiq-pg-1.3.2.tar.gz
| Download URL | django-dramatiq-pg-1.3.2.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07f7f92928c70bb9a34d8d30efde8a319a2bdbb90d61f5993dce9c51b7b5b56e
|
|
BLAKE2b-256 checksum How to use checksums |
e4ac894efbb51c852e330042f045af54fdf6122d5d4d8bd155f5085dcaf5d081
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.0 CPython/3.8.0 Darwin/19.6.0
|
Release files / django_dramatiq_pg-1.3.2-py3-none-any.whl
| Download URL | django_dramatiq_pg-1.3.2-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9cc3c48bc5ba18d6a1bc03fb5af44456349ba22b89df14f97e64ae0719dbb4e
|
|
BLAKE2b-256 checksum How to use checksums |
3bfce5d33d10fcb275fce084d6d859aee1d202265d88052210b672c8ba86c655
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.0 CPython/3.8.0 Darwin/19.6.0
|
Security for django-dramatiq-pg 1.3.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.