flask/examples/celery
ahsan.sheraz 330fc07272 fix(security): update vulnerable dependencies in celery example
Update pinned versions in examples/celery/requirements.txt to resolve
13 known security vulnerabilities (1 HIGH, 11 MEDIUM, 1 LOW):

- werkzeug 2.3.3 -> 3.1.6 (CVE-2024-34069, CVE-2023-46136, CVE-2024-49766, CVE-2024-49767, CVE-2025-66221, CVE-2026-21860, CVE-2026-27199)
- jinja2 3.1.2 -> 3.1.6 (CVE-2024-22195, CVE-2024-34064, CVE-2024-56201, CVE-2024-56326, CVE-2025-27516)
- flask 2.3.2 -> 3.1.3 (CVE-2026-27205)

Also bumps transitive deps for compatibility:
- blinker 1.6.2 -> 1.9.0
- itsdangerous 2.1.2 -> 2.2.0
- markupsafe 2.1.2 -> 3.0.3
2026-04-10 18:09:08 +02:00
..
src/task_app add celery example 2023-02-10 09:16:53 -08:00
make_celery.py add celery example 2023-02-10 09:16:53 -08:00
pyproject.toml update example project metadata 2024-11-01 18:00:39 -07:00
README.md show 'run --debug' in docs 2023-02-15 14:33:32 -08:00
requirements.txt fix(security): update vulnerable dependencies in celery example 2026-04-10 18:09:08 +02:00

Background Tasks with Celery

This example shows how to configure Celery with Flask, how to set up an API for submitting tasks and polling results, and how to use that API with JavaScript. See Flask's documentation about Celery.

From this directory, create a virtualenv and install the application into it. Then run a Celery worker.

$ python3 -m venv .venv
$ . ./.venv/bin/activate
$ pip install -r requirements.txt && pip install -e .
$ celery -A make_celery worker --loglevel INFO

In a separate terminal, activate the virtualenv and run the Flask development server.

$ . ./.venv/bin/activate
$ flask -A task_app run --debug

Go to http://localhost:5000/ and use the forms to submit tasks. You can see the polling requests in the browser dev tools and the Flask logs. You can see the tasks submitting and completing in the Celery logs.