0

我想在我的开发机器上运行 celery,将 django 作为代理和结果后端(使用 djcelery)。我遵循了 celery 文档中的入门说明,但是当我运行命令时:

celery -A excelery worker -l info

我在我的控制台上得到了这个堆栈跟踪。它说 django 设置模块无法加载,但我现在不知道为什么。

我正在使用 celery 3.1.4、djcelery 3.1.1 和 Django 1.6。

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python27\lib\site-packages\billiard-3.3.0.7-py2.7-win32.egg\billiard\
forking.py", line 457, in main
self = load(from_parent)
File "C:\Python27\lib\pickle.py", line 1378, in load
return Unpickler(file).load()
File "C:\Python27\lib\pickle.py", line 858, in load
dispatch[key](self)
File "C:\Python27\lib\pickle.py", line 1133, in load_reduce
value = func(*args)
File "C:\Python27\lib\site-packages\celery-3.1.4-py2.7.egg\celery\app\utils.py
", line 170, in _unpickle_app_v2
return cls(**kwargs)
File "C:\Python27\lib\site-packages\celery-3.1.4-py2.7.egg\celery\app\base.py"
, line 136, in __init__
symbol_by_name(fixup)(self)
File "C:\Python27\lib\site-packages\celery-3.1.4-py2.7.egg\celery\fixups\djang
o.py", line 39, in fixup
return DjangoFixup(app).install()
File "C:\Python27\lib\site-packages\celery-3.1.4-py2.7.egg\celery\fixups\djang
o.py", line 50, in __init__
self._db = import_module('django.db')
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\Python27\lib\site-packages\django\db\__init__.py", line 83, in <modul
e>
signals.request_started.connect(reset_queries)
File "C:\Python27\lib\site-packages\django\dispatch\dispatcher.py", line 88, i
n connect
if settings.DEBUG:
File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 54, in __ge
tattr__
self._setup(name)
File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 49, in _set
up
self._wrapped = Settings(settings_module)
File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 132, in __i
nit__
% (self.SETTINGS_MODULE, e)
ImportError: Could not import settings 'excelery.settings' (Is it on sys.path? I
s there an import error in the settings file?): cannot import name close_old_con
nections
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python27\lib\site-packages\billiard-3.3.0.7-py2.7-win32.egg\billiard\
forking.py", line 457, in main
self = load(from_parent)
File "C:\Python27\lib\pickle.py", line 1378, in load
return Unpickler(file).load()
File "C:\Python27\lib\pickle.py", line 858, in load
dispatch[key](self)
File "C:\Python27\lib\pickle.py", line 1133, in load_reduce
value = func(*args)
File "C:\Python27\lib\site-packages\celery-3.1.4-py2.7.egg\celery\app\utils.py
", line 170, in _unpickle_app_v2
return cls(**kwargs)
File "C:\Python27\lib\site-packages\celery-3.1.4-py2.7.egg\celery\app\base.py"
, line 136, in __init__
symbol_by_name(fixup)(self)
File "C:\Python27\lib\site-packages\celery-3.1.4-py2.7.egg\celery\fixups\djang
o.py", line 39, in fixup
return DjangoFixup(app).install()
File "C:\Python27\lib\site-packages\celery-3.1.4-py2.7.egg\celery\fixups\djang
o.py", line 50, in __init__
self._db = import_module('django.db')
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\Python27\lib\site-packages\django\db\__init__.py", line 83, in <modul
e>
signals.request_started.connect(reset_queries)
File "C:\Python27\lib\site-packages\django\dispatch\dispatcher.py", line 88, i
n connect
if settings.DEBUG:
File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 54, in __ge
tattr__
self._setup(name)
File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 49, in _set
up
self._wrapped = Settings(settings_module)
File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 132, in __i
nit__
% (self.SETTINGS_MODULE, e)
ImportError: Could not import settings 'excelery.settings' (Is it on sys.path? I
s there an import error in the settings file?): cannot import name close_old_con
nections
[2013-11-23 16:34:06,471: ERROR/MainProcess] Process 'Worker-2' pid:2332 exited
with exitcode 1
4

0 回答 0