gpt4 book ai didi

django celery 获取类型错误 : 'tuple' object is not callable

转载 作者:行者123 更新时间:2023-12-02 04:18:34 27 4
gpt4 key购买 nike

我刚刚使用 RabbitMQ 在我的本地计算机 (win10) 上安装了 celery,并按照他们的 beginners tutorial 进行操作。 。但我收到错误消息 TypeError: 'tuple' object is not callable

src>workon clicknstrip
(clicknstrip) src>python manage.py celery beat

celery beat v3.1.18 (Cipater) is starting.
__ - ... __ - _
Configuration ->
. broker -> amqp://guest:**@localhost:5672//
. loader -> celery.loaders.app.AppLoader
. scheduler -> celery.beat.PersistentScheduler
. db -> celerybeat-schedule
. logfile -> [stderr]@%INFO
. maxinterval -> now (0s)
[2015-08-13 10:01:13,441: INFO/MainProcess] beat: Starting...
[2015-08-13 10:01:13,466: WARNING/MainProcess] DB Reset: Account for new __version__ field
[2015-08-13 10:01:13,470: CRITICAL/MainProcess] beat raised exception <type 'exceptions.TypeError'>: TypeError("'tuple' object is not callable",)
Traceback (most recent call last):
File "clicknstrip\lib\site-packages\celery\apps\beat.py", line 112, in start_scheduler
beat.start()
File "clicknstrip\lib\site-packages\celery\beat.py", line 454, in start
humanize_seconds(self.scheduler.max_interval))
File "clicknstrip\lib\site-packages\kombu\utils\__init__.py", line 322, in __get__
value = obj.__dict__[self.__name__] = self.__get(obj)
File "clicknstrip\lib\site-packages\celery\beat.py", line 494, in scheduler
return self.get_scheduler()
File "clicknstrip\lib\site-packages\celery\beat.py", line 489, in get_scheduler
lazy=lazy)
File "clicknstrip\lib\site-packages\celery\utils\imports.py", line 53, in instantiate
return symbol_by_name(name)(*args, **kwargs)
File "clicknstrip\lib\site-packages\celery\beat.py", line 358, in __init__
Scheduler.__init__(self, *args, **kwargs)
File "clicknstrip\lib\site-packages\celery\beat.py", line 185, in __init__
self.setup_schedule()
File "clicknstrip\lib\site-packages\celery\beat.py", line 406, in setup_schedule
self.install_default_entries(self.schedule)
File "clicknstrip\lib\site-packages\celery\beat.py", line 190, in install_default_entries
not self.app.backend.supports_autoexpire:
File "clicknstrip\lib\site-packages\kombu\utils\__init__.py", line 322, in __get__
value = obj.__dict__[self.__name__] = self.__get(obj)
File "clicknstrip\lib\site-packages\celery\app\base.py", line 625, in backend
return self._get_backend()
File "clicknstrip\lib\site-packages\celery\app\base.py", line 444, in _get_backend
return backend(app=self, url=url)
TypeError: 'tuple' object is not callable

这是我的 celery.py

from __future__ import absolute_import
import os
from celery import Celery

# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'clicknstrip.settings.local')

from django.conf import settings

app = Celery('clicknstrip')

# Using a string here means the worker will not have to
# pickle the object when using Windows.
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)


@app.task(bind=True)
def debug_task(self):
print('Request: {0!r}'.format(self.request))

这是我的任务.py

from __future__ import absolute_import

from celery import shared_task


@shared_task
def add(x, y):
return x + y


@shared_task
def mul(x, y):
return x * y


@shared_task
def xsum(numbers):
return sum(numbers)

最佳答案

发现我的问题,因为我在

末尾添加了额外的逗号

CELERY_RESULT_BACKEND='djcelery.backends.database:DatabaseBackend',

关于django celery 获取类型错误 : 'tuple' object is not callable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31990601/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com