Read configuration from :file:`celeryconfig.py`.
(self, fail_silently=True)
| 23 | return DictAttribute(settingsdict) |
| 24 | |
| 25 | def read_configuration(self, fail_silently=True): |
| 26 | """Read configuration from :file:`celeryconfig.py`.""" |
| 27 | configname = os.environ.get('CELERY_CONFIG_MODULE', |
| 28 | DEFAULT_CONFIG_MODULE) |
| 29 | try: |
| 30 | usercfg = self._import_config_module(configname) |
| 31 | except ImportError: |
| 32 | if not fail_silently: |
| 33 | raise |
| 34 | # billiard sets this if forked using execv |
| 35 | if C_WNOCONF and not os.environ.get('FORKED_BY_MULTIPROCESSING'): |
| 36 | warnings.warn(NotConfigured( |
| 37 | 'No {module} module found! Please make sure it exists and ' |
| 38 | 'is available to Python.'.format(module=configname)), |
| 39 | stacklevel=2, |
| 40 | ) |
| 41 | return self.setup_settings({}) |
| 42 | else: |
| 43 | self.configured = True |
| 44 | return self.setup_settings(usercfg) |