3

当我尝试为我的 django 应用程序运行 celery worker 时,出现导入错误。

据我所知,这是 kombu.utils 中的导入失败

接下来是一个相当大的堆栈跟踪:

$ ./manage.py celery worker --loglevel=info
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/djcelery/management/commands/celery.py", line 22, in run_from_argv
    ["%s %s" % (argv[0], argv[1])] + argv[2:])
  File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 890, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 179, in execute_from_commandline
    return self.handle_argv(prog_name, argv[1:])
  File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 882, in handle_argv
    return self.execute(command, argv)
  File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 857, in execute
    return cls(app=self.app).run_from_argv(self.prog_name, argv)
  File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 142, in run_from_argv
    return self(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 112, in __call__
    ret = self.run(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 214, in run
    return self.target.run(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/celery/bin/celeryd.py", line 153, in run
    return self.app.Worker(**kwargs).run()
  File "/usr/local/lib/python2.7/dist-packages/celery/apps/worker.py", line 176, in run
    print(str(self.colored.cyan(' \n', self.startup_info())) +
  File "/usr/local/lib/python2.7/dist-packages/celery/apps/worker.py", line 246, in startup_info
    'conninfo': self.app.connection().as_uri(),
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 446, in as_uri
    fields = self.info()
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 435, in info
    return OrderedDict(self._info())
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 414, in _info
    D = self.transport.default_connection_params
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 637, in transport
    self._transport = self.create_transport()
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 395, in create_transport
    return self.get_transport_cls()(client=self)
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 402, in get_transport_cls
    transport_cls = get_transport_cls(transport_cls)
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/__init__.py", line 104, in get_transport_cls
    _transport_cache[transport] = resolve_transport(transport)
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/__init__.py", line 88, in resolve_transport
    return symbol_by_name(transport)
  File "/usr/local/lib/python2.7/dist-packages/kombu/utils/__init__.py", line 81, in symbol_by_name
    module = imp(module_name, package=package, **kwargs)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: Import by filename is not supported.
4

1 回答 1

5

啊找到了答案,我使用的是 CELERY_RESULT_BACKEND = someUrl 而不是“redis”等

于 2012-10-20T16:35:40.973 回答