|
@@ -1,5 +1,8 @@
|
|
|
+import os
|
|
|
from celery.loaders.base import BaseLoader
|
|
|
|
|
|
+DEFAULT_CONFIG_MODULE = "celeryconfig"
|
|
|
+
|
|
|
DEFAULT_SETTINGS = {
|
|
|
"DEBUG": False,
|
|
|
"DATABASE_ENGINE": "sqlite3",
|
|
@@ -21,9 +24,12 @@ class Loader(BaseLoader):
|
|
|
"""
|
|
|
|
|
|
def read_configuration(self):
|
|
|
- """Read configuration from ``celeryconf.py`` and configure
|
|
|
+ """Read configuration from ``celeryconfig.py`` and configure
|
|
|
celery and Django so it can be used by regular Python."""
|
|
|
config = dict(DEFAULT_SETTINGS)
|
|
|
+ configname = os.environ.get("CELERY_CONFIG_MODULE",
|
|
|
+ DEFAULT_CONFIG_MODULE)
|
|
|
+ celeryconfig = __import__(configname, {}, {}, [''])
|
|
|
import celeryconfig
|
|
|
usercfg = dict((key, getattr(celeryconfig, key))
|
|
|
for key in dir(celeryconfig)
|