Skip to main content

Adds Dramatiq support to your Flask application

Project description

Flask-Dramatiq

Flask-Dramatiq plugs Dramatiq task queue in your Flask web application.

// Features //

  • Configure Dramatiq from Flask configuration.
  • Ensure Flask app is available to Dramatiq actor.
  • Add worker command to Flask CLI.
  • Enable Flask Application factory.
  • Handle multiple brokers with configurable prefix.
  • Integrates periodiq. Optionnal.

Full documentation at flask-dramatiq.readthedocs.io.

// Installation and Usage //

Flask-Dramatiq is licensed under BSD-3-Clause. Add flask-dramatiq to your project:

$ uv add flask-dramatiq

Then use Dramatiq object as a regular Flask extension:

from flask import Flask
from flask_dramatiq import Dramatiq

app = Flask(__name__)
dramatiq = Dramatiq(app)

@dramatiq.actor()
def my_actor():
    ...

@app.route("/")
def myhandler():
    my_actor.send()

Flask-Dramatiq adds two configuration keys:

  • DRAMATIQ_BROKER, points to broker class like dramatiq.brokers.rabbitmq:RabbitmqBroker or dramatiq.brokers.redis:RedisBroker.
  • DRAMATIQ_BROKER_URL is passed as url keyword argument to broker class.

Now run worker program to consume messages and execute tasks in the background:

$ flask worker --processes=1

A complete flask app is available in project source tree example.py.

// Credit and Support //

Feel free to open an issue or suggest a merge request on Github project page. Contribution welcome!

The project is based on Bogdanp/flask_dramatiq_example.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_dramatiq-0.7.0.tar.gz (583.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_dramatiq-0.7.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file flask_dramatiq-0.7.0.tar.gz.

File metadata

  • Download URL: flask_dramatiq-0.7.0.tar.gz
  • Upload date:
  • Size: 583.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flask_dramatiq-0.7.0.tar.gz
Algorithm Hash digest
SHA256 8d2c772402b50bfef9f440b36adc39d10b77333526b84ef84a559b67aae456ca
MD5 cd9c3c9dea82708f341e8762105552cb
BLAKE2b-256 93c28a2c7e1bae91a1d0af95f897697c673750789da42769838702a843115a8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for flask_dramatiq-0.7.0.tar.gz:

Publisher: publish.yml on pallets-eco/flask-dramatiq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flask_dramatiq-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: flask_dramatiq-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flask_dramatiq-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 debd1b76ac5b7cbe6b35eb17a012ca10ce563cfe18ca230b3a113294895dc0d3
MD5 72be7ee50ea7746cd7b818bd6622cb21
BLAKE2b-256 cb2623df740373fd79698bef28ff627d56f09ea8963aa1415e5b6afa7bb0aecc

See more details on using hashes here.

Provenance

The following attestation bundles were made for flask_dramatiq-0.7.0-py3-none-any.whl:

Publisher: publish.yml on pallets-eco/flask-dramatiq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page