README.md
This file
Path
examples/celery/README.md
27 lines · 950 bytes · Markdown
Last changed by
Merge branch '2.2.x'David Lordbefore adoptioned5b240
History of this fileTake it
Merge branch '2.2.x'David Lordbefore adoptiona18ae3d
lines 1–21why, one step back1Background Tasks with Celery2============================34This example shows how to configure Celery with Flask, how to set up an API for5submitting tasks and polling results, and how to use that API with JavaScript. See6[Flask's documentation about Celery](https://flask.palletsprojects.com/patterns/celery/).78From this directory, create a virtualenv and install the application into it. Then run a9Celery worker.1011```shell12$ python3 -m venv .venv13$ . ./.venv/bin/activate14$ pip install -r requirements.txt && pip install -e .15$ celery -A make_celery worker --loglevel INFO16```1718In a separate terminal, activate the virtualenv and run the Flask development server.1920```shell21$ . ./.venv/bin/activateMerge branch '2.2.x'David Lordbefore adoptioned5b240
line 22why, one step back22$ flask -A task_app run --debugMerge branch '2.2.x'David Lordbefore adoptiona18ae3d
lines 23–27why, one step back23```2425Go to http://localhost:5000/ and use the forms to submit tasks. You can see the polling26requests in the browser dev tools and the Flask logs. You can see the tasks submitting27and completing in the Celery logs.