我有一个使用Celery运行异步任务的 Django 项目。我正在 Windows XP 机器上进行开发。
启动我的 Django 服务器 ( python manage.py runserver 80
) 工作正常,但尝试启动 Celery Daemon ( python manage.py celeryd start
) 失败并出现以下错误:
ImportError:无法导入设置“src.settings”(它在 sys.path 上吗?是否有语法错误?):没有名为 src.settings 的模块
sys.path 包含'C:\development\SpaceCorps\src',所以我不确定为什么它找不到这个模块。
这是启动守护程序的完整输出:
C:\development\SpaceCorps\src>python manage.py celeryd start
[2010-07-23 18:29:31,456: WARNING/MainProcess] ?[1;33mcelery@mike-laptop v2.0.1 is starting.?[0m
[2010-07-23 18:29:31,456: WARNING/MainProcess] ?[1;33mC:\Program Files\Python26\lib\site-packages\celery-2.0.1-py2.6.egg\celery\bin\celeryd.py:206: UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in a production environment!
warnings.warn("Using settings.DEBUG leads to a memory leak, "?[0m
[2010-07-23 18:29:31,456: WARNING/MainProcess] ?[1;33mConfiguration ->
. broker -> amqp://guest@localhost:5672/
. queues ->
. celery -> exchange:celery (direct) binding:celery
. concurrency -> 2
. loader -> djcelery.loaders.DjangoLoader
. logfile -> [stderr]@WARNING
. events -> OFF
. beat -> OFF?[0m
[2010-07-23 18:29:31,706: WARNING/MainProcess] ?[1;33mcelery@mike-laptop has started.?[0m
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\Python26\lib\multiprocessing\forking.py", line 342, in main
self = load(from_parent)
File "C:\Program Files\Python26\lib\pickle.py", line 1370, in load
return Unpickler(file).load()
File "C:\Program Files\Python26\lib\pickle.py", line 858, in load
Traceback (most recent call last):
File "<string>", line 1, in <module>
dispatch[key](self)
File "C:\Program Files\Python26\lib\pickle.py", line 1090, in load_global
File "C:\Program Files\Python26\lib\multiprocessing\forking.py", line 342, in main
self = load(from_parent)
File "C:\Program Files\Python26\lib\pickle.py", line 1370, in load
klass = self.find_class(module, name)
File "C:\Program Files\Python26\lib\pickle.py", line 1124, in find_class
return Unpickler(file).load()
File "C:\Program Files\Python26\lib\pickle.py", line 858, in load
dispatch[key](self)
File "C:\Program Files\Python26\lib\pickle.py", line 1090, in load_global
__import__(module)
File "C:\Program Files\Python26\lib\site-packages\celery-2.0.1-py2.6.egg\celery\concurrency\processes\__init__.py", line 7, in <module>
from celery import log
File "C:\Program Files\Python26\lib\site-packages\celery-2.0.1-py2.6.egg\celery\log.py", line 8, in <module>
from celery import conf
File "C:\Program Files\Python26\lib\site-packages\celery-2.0.1-py2.6.egg\celery\conf.py", line 118, in <module>
ALWAYS_EAGER = _get("CELERY_ALWAYS_EAGER")
File "C:\Program Files\Python26\lib\site-packages\celery-2.0.1-py2.6.egg\celery\conf.py", line 109, in _get
value = getattr(settings, alias)
File "c:\development\django\django\utils\functional.py", line 276, in __getattr__
self._setup()
File "c:\development\django\django\conf\__init__.py", line 40, in _setup
self._wrapped = Settings(settings_module)
File "c:\development\django\django\conf\__init__.py", line 75, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'src.settings' (Is it on sys.path? Does it have syntax errors?): No module named src.settings