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.

Full documentation at flask-dramatiq.readthedocs.io.

// Installation and Usage //

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

$ poetry 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 Gitlab 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.4.1.tar.gz (5.2 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.4.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file flask-dramatiq-0.4.1.tar.gz.

File metadata

  • Download URL: flask-dramatiq-0.4.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.16 CPython/3.6.7 Linux/4.19.0-4-amd64

File hashes

Hashes for flask-dramatiq-0.4.1.tar.gz
Algorithm Hash digest
SHA256 50cb9be01487c0191f7aebd9f3a091041fcc567bfce3ba20f71ba0960e60d1bc
MD5 e3f304193d63fa71c5053018a4452386
BLAKE2b-256 5e3f9bb3ebed342bd2fafdd84701ad32804e7f3c87e3ca74add0591d1c9e6e84

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flask_dramatiq-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.16 CPython/3.6.7 Linux/4.19.0-4-amd64

File hashes

Hashes for flask_dramatiq-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 48257d7fd2c9f3475a85ef68a45f6100d1ffa6682b9933fcee713e57572a4746
MD5 ce451e75d637c185a73e017cd04fba79
BLAKE2b-256 65580e9c813130db2e071ec3e8fbd8081b76b806f023e133e2e96227bdd23d48

See more details on using hashes here.

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