Ahora en Apio 4.1 se puede resolver ese problema mediante ese código (la forma más fácil):
import celeryconfig
from celery import Celery
app = Celery()
app.config_from_object(celeryconfig)
Por ejemplo pequeña celeryconfig.py:
también de forma muy sencilla:
from celery import Celery
app = Celery('tasks')
app.conf.update(
result_expires=60,
task_acks_late=True,
broker_url='pyamqp://',
result_backend='redis://localhost'
)
o el uso de una clase de configuración/objeto:
from celery import Celery
app = Celery()
class Config:
enable_utc = True
timezone = 'Europe/London'
app.config_from_object(Config)
# or using the fully qualified name of the object:
# app.config_from_object('module:Config')
O cómo fue mencionado por el establecimiento CELERY_CONFIG_MODULE
import os
from celery import Celery
#: Set default configuration module name
os.environ.setdefault('CELERY_CONFIG_MODULE', 'celeryconfig')
app = Celery()
app.config_from_envvar('CELERY_CONFIG_MODULE')
Véase también:
Pregunta estúpida ... (porque he hecho esto) cuando se ejecuta pitón que está ejecutando la versión correcta. Trabajé en sistemas con 2 versiones de Python ... no preguntes. –