我正在尝试使用带有Django 1.6的芹菜3.1.0。我已经完成了本教程,但是一旦我使用它描述的方法(celery -A proj worker -l info
)调用芹菜,我会收到以下错误:
Traceback (most recent call last):
File "/Users/dustin/.virtualenvs/proj_env/bin/celery", line 9, in <module>
load_entry_point('celery==3.1.0', 'console_scripts', 'celery')()
File "/Users/dustin/.virtualenvs/proj_env/lib/python2.7/site-packages/celery/__main__.py", line 29, in main
main()
File "/Users/dustin/.virtualenvs/proj_env/lib/python2.7/site-packages/celery/bin/celery.py", line 80, in main
cmd.execute_from_commandline(argv)
File "/Users/dustin/.virtualenvs/proj_env/lib/python2.7/site-packages/celery/bin/celery.py", line 732, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "/Users/dustin/.virtualenvs/proj_env/lib/python2.7/site-packages/celery/bin/base.py", line 299, in execute_from_commandline
argv = self.setup_app_from_commandline(argv)
File "/Users/dustin/.virtualenvs/proj_env/lib/python2.7/site-packages/celery/bin/base.py", line 429, in setup_app_from_commandline
self.app = self.find_app(app)
File "/Users/dustin/.virtualenvs/proj_env/lib/python2.7/site-packages/celery/bin/base.py", line 463, in find_app
'{0}.celery:'.format(app.replace(':', '')),
File "/Users/dustin/.virtualenvs/proj_env/lib/python2.7/site-packages/celery/bin/base.py", line 449, in find_app
sym = self.symbol_by_name(app)
File "/Users/dustin/.virtualenvs/proj_env/lib/python2.7/site-packages/celery/bin/base.py", line 474, in symbol_by_name
return symbol_by_name(name, imp=import_from_cwd)
File "/Users/dustin/.virtualenvs/proj_env/lib/python2.7/site-packages/kombu/utils/__init__.py", line 90, in symbol_by_name
module = imp(module_name, package=package, **kwargs)
File "/Users/dustin/.virtualenvs/proj_env/lib/python2.7/site-packages/celery/utils/imports.py", line 101, in import_from_cwd
return imp(module, package=package)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/dustin/src/myco/proj/proj/celery.py", line 13, in <module>
app.autodiscover_tasks(settings.INSTALLED_APPS, related_name='tasks')
File "/Users/dustin/.virtualenvs/proj_env/lib/python2.7/site-packages/celery/app/base.py", line 277, in autodiscover_tasks
if self.conf.CELERY_FORCE_BILLIARD_LOGGING:
File "/Users/dustin/.virtualenvs/proj_env/lib/python2.7/site-packages/celery/datastructures.py", line 336, in __getattr__
return self[k]
File "/Users/dustin/.virtualenvs/proj_env/lib/python2.7/site-packages/celery/datastructures.py", line 458, in __getitem__
return d[key]
File "/Users/dustin/.virtualenvs/proj_env/lib/python2.7/site-packages/django/utils/functional.py", line 214, in inner
return func(self._wrapped, *args)
File "/Users/dustin/.virtualenvs/proj_env/lib/python2.7/site-packages/django/utils/functional.py", line 263, in __getitem__
return self[key]
TypeError: 'Settings' object has no attribute '__getitem__'
之前有没有遇到过这个?我错过了什么?
答案 0 :(得分:10)
我通过将我的celery包绑定到与我的django应用程序一起使用的版本来修复此错误。
那些是抛出错误的版本
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: **<?php echo json_encode($d_dates);?>**,
datasets: [{
......
这是适合我的版本
celery # the newest
celery==3.1 # main version before the newest
答案 1 :(得分:0)
我使用celery==3.1.25
来解决问题
答案 2 :(得分:-1)
Celery == 3.1 django == 1.10 django-celery == 3.1.17
此版本效果不佳