8000 GitHub - pallets-eco/flask-rq: RQ (Redis Queue) integration for Flask and Quart applications.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

pallets-eco/flask-rq

Repository files navigation

Flask-RQ

Flask-RQ is a Flask/Quart extension that background job execution using RQ. RQ allows queueing functions to be run in separate worker processes, allowing long-running jobs to run in the background without blocking the web app from returning a response quickly. Flask-RQ allows configuring RQ using Flask's config, and handles executing jobs in the application context, so other services like database connections are available.

Pallets Community Ecosystem

Important

This project is part of the Pallets Community Ecosystem. Pallets is the open source organization that maintains Flask; Pallets-Eco enables community maintenance of related projects. If you are interested in helping maintain this project, please reach out on the Pallets Discord server.

Installation

Install from PyPI:

$ pip install flask-rq

Example

from flask import Flask, g
from flask_rq import RQ

app = Flask(__name__)
rq = RQ(app)

@rq.job
def send_password_reset_job(user_id:  int) -> None:
    ...

@app.route("/auth/send-password-reset")
def send_password_reset():
    send_password_reset_job.enqueue(user_id=g.user.id)
    return "Check your email!"
$ flask rq worker

About

RQ (Redis Queue) integration for Flask and Quart applications.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors 7

Languages

0