Add an option to load configuration from a file, rather than an importable module. #5303
Open
2 tasks done
Projects
Milestone
Checklist
celery/app/base.py
andcelery/loaders
and I didn't see any additionalconfig_from_
methods.Brief Summary
I would like to load configuration from a python-like file rather than a module. Similar to flask's
from_pyfile
.The key here is that the config file is not on python's path, nor is it part of any package.
Why do I want this? Well primarily it stems from the fact that I've gotten used to doing it this way in Flask and I want to put the Celery config in the same file as the Flask config...
Design
Architectural Considerations
None that I can tell.
Proposed Behavior
This would simply be an addition to the current "config_from_X" methods. The current methods require a Python module, which I find to be somewhat restrictive.
Easiest explained with an example:
Usage:
Proposed UI/UX
New API:
Updated API:
celery.Celery.config_from_envvar
also accepts non-module values, eg: "/var/www/app/config.cfg"Diagrams
N/A
Alternatives
My current workaround is below. The only disadvantage that can see to this workaround is that there is no option for lazy loading. I don't know how to implement that, nor do I have the need for it.
The text was updated successfully, but these errors were encountered: