Found it: Celery 3.1 apparently loads the configuration lazily. The (undocumented) force
argument to config_from_object
can apparently be used to suppress lazy loading.
Catch error when loading Celery config
-
27-09-2022 - |
Pregunta
I'm trying to catch an ImportError
from Celery's config_from_object
because I want the configuration to be loaded from a default module when it's not available. I tried
app = Celery('foo', include=['foo.tasks'])
try:
app.config_from_object('foo_config')
except ImportError:
app.config_from_object('foo.defaultconfig')
but this doesn't load the default configuration. What's going on here?
Solución
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow