Skip to main content

Adds Dramatiq support to your Flask application

Project description

// Flask-Dramatiq //

Flask-Dramatiq plugs Dramatiq in your Flask 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.

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.2.1.tar.gz (4.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.2.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flask-dramatiq-0.2.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.10 CPython/3.6.7 Linux/4.19.0-2-amd64

File hashes

Hashes for flask-dramatiq-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d8329d250b0ebb8fd84c60b5307692488195eef819e2ebb87a8a628abbc5aec2
MD5 a1b55aecf8c3b8f9a8d58b5e85fd0800
BLAKE2b-256 7d2f081a73001e63c6c0c28a5fc900cc92e5af2c2a72375bd63f6b452503d5f9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for flask_dramatiq-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 479c0927a2d229935eeee958e2b613d4468dbb378509133a137d4018588e46ae
MD5 89e6a50af4e85ab6df583397d5591314
BLAKE2b-256 71d2fbee89a1a9efd03510bf2550aa716488bef0eb1c83130cf657dfe3f78307

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