Celery Bundle

Integrates Celery with Flask Unchained.

Dependencies

  • A broker of some sort; Redis or RabbitMQ are popular choices.

Installation

Install dependencies:

pip install "flask-unchained[celery]" <broker-of-choice>

And enable the celery bundle in your unchained_config.py:

# your_project_root/unchained_config.py

BUNDLES = [
    # ...
    'flask_unchained.bundles.celery',
    'app',
]

NOTE: If you have enabled the Mail Bundle, and want to send emails asynchronously using celery, then you must list the celery bundle after the mail bundle in BUNDLES.

Config

class flask_unchained.bundles.celery.config.Config[source]

Default configuration options for the Celery Bundle.

CELERY_BROKER_URL = 'redis://127.0.0.1:6379/0'

The broker URL to connect to.

CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379/0'

The result backend URL to connect to.

CELERY_ACCEPT_CONTENT = ('json', 'pickle', 'dill')

Tuple of supported serialization strategies.

MAIL_SEND_FN(to=None, template=None, **kwargs)

If the celery bundle is listed after the mail bundle in unchained_config.BUNDLES, then this configures the mail bundle to send emails asynchronously.

Commands

flask celery

Celery commands.

flask celery COMMAND [<args>...] [OPTIONS]

beat

Start the celery beat.

flask celery beat [OPTIONS]

worker

Start the celery worker.

flask celery worker [OPTIONS]

API Docs

See Celery Bundle API