Skip to content

Celery

Requires the celery extra.

rn_forge.django.celery

Celery app factory and retryable-task defaults.

RETRYABLE_TASK_KWARGS = {'autoretry_for': (Exception,), 'retry_backoff': True, 'retry_kwargs': {'max_retries': 5}} module-attribute

Spread into @shared_task(**RETRYABLE_TASK_KWARGS): exponential backoff, five retries.

A plain dict rather than a decorator, and its exact shape is asserted by a test — consumers spread it directly, so a silent change here changes their retry behaviour.

make_app(name, *, config_source='django.conf:settings', namespace='CELERY', autodiscover=True)

Return a Celery app configured from Django settings.

Parameters:

Name Type Description Default
name str

The app's main module name.

required
config_source str

What config_from_object reads.

'django.conf:settings'
namespace str

The settings prefix: CELERY_BROKER_URL → broker_url.

'CELERY'
autodiscover bool

Look for tasks.py in every installed app.

True