Skip to main content
Version:
2.4.3

FROM CELERY 3.0 THIS LIBRARY IS NO LONGER NECESSARY, INSTEAD YOU SHOULD USE THE STANDARD CELERY API

Using Flask with Celery

From Celery 3.0 the Flask-Celery integration package is no longer recommended and you should use the standard Celery API instead.

Please read the Celery getting started tutorial:

http://docs.celeryproject.org/en/latest/getting-started/first-steps-with-celery.html

You can easily add Celery to your flask application like this:

myapp.py:

from celery import Celery

celery = Celery('myapp', broker='amqp://guest@localhost//')

@celery.task
def add(x, y):
    return x + y

To start the worker you can then launch the celery worker command by pointing to your celery app instance:

$ celery -A myapp worker -l info

(if the app argument (-A|--app) is a module/package instead of an attribute it will automatically expand into myapp.celery)

See the commands help screen for more information:

$ celery help

If you want use the flask configuration as a source for the celery configuration you can do that like this:

celery = Celery('myapp')
celery.config_from_object(flask_app.config)

If you need access to the request inside your task then you can use the test context:

from flask import Flask
from celery import Celery

app = Flask('myapp')
celery = Celery('myapp')

celery.config_from_object(app.config)

@celery.task
def hello():
    with app.test_request_context() as request:
        print('Hello {0!r}.format(request))

Release files for Flask-Celery 2.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-Celery 2.4.3
File Size Uploaded
Flask-Celery-2.4.3.tar.gz 6.2 kB Details

Release files / Flask-Celery-2.4.3.tar.gz

Download URL Flask-Celery-2.4.3.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5df7adb71c6d41e1cb3aa87fdbe0750a5aa2f6daa7fb8cdb427ec398fd1f2973
BLAKE2b-256 checksum
How to use checksums
e733cafb4f8e1a3800f72d482377907803a84f8f6d6ad6f2f006211ae785ea0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

2.4.3 This release

1 release file

2.4.2

1 release file

2.4.1

1 release file

2.4.0

1 release file

2.2.5

1 release file

2.2.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page