https://github.com/pallets-eco/flask-rq
RQ (Redis Queue) integration for Flask applications
https://github.com/pallets-eco/flask-rq
Last synced: 13 days ago
JSON representation
RQ (Redis Queue) integration for Flask applications
- Host: GitHub
- URL: https://github.com/pallets-eco/flask-rq
- Owner: pallets-eco
- License: mit
- Created: 2012-07-17T05:19:01.000Z (almost 13 years ago)
- Default Branch: main
- Last Pushed: 2024-05-22T16:05:16.000Z (11 months ago)
- Last Synced: 2024-05-22T16:54:53.077Z (11 months ago)
- Language: Python
- Size: 48.8 KB
- Stars: 211
- Watchers: 8
- Forks: 32
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES
- License: LICENSE
- Authors: AUTHORS
Awesome Lists containing this project
- awesome-flask - Flask-RQ - [RQ](https://python-rq.org/) (Redis Queue) integration. (Third-Party Extensions / Task Queues)
- jimsghstars - pallets-eco/flask-rq - RQ (Redis Queue) integration for Flask applications (Python)
README
# 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.[Flask]: https://flask.palletsprojects.com
[Quart]: https://quart.palletsprojects.com
[RQ]: https://python-rq.org## 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][discord].[discord]: https://discord.gg/pallets
## Installation
Install from [PyPI]:
```
$ pip install flask-rq
```[PyPI]: https://pypi.org/project/Flask-RQ/
## Example
```python
from flask import Flask, g
from flask_rq import RQapp = 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
```