简体   繁体   English

Django celery 结果不存储任务结果

[英]Django celery results does not store task results

The problem speaks for itself - django-celery-results does not store any task results.问题不言自明——django-celery-results 不存储任何任务结果。

I did everything as it was described in 'getting started' section in documentation, but still no results.我按照文档“入门”部分中的描述做了一切,但仍然没有结果。

I'm using django 4.1.2 and django-celery-results 2.4.0我正在使用 django 4.1.2 和 django-celery-results 2.4.0

Here is related variables from settings.py:这是 settings.py 中的相关变量:

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.redis.RedisCache',
        'LOCATION': 'redis://redis:6379',
    }
}
CELERY_BROKER_URL = os.environ.get("CELERY_BROKER", "redis://redis:6379")
CELERY_RESULT_BACKEND = os.environ.get("CELERY_BACKEND", "django-db")
CELERY_CACHE_BACKEND = "django-cache"
CELERY_RESULT_EXTENDED = True

I also tried database cache - nothing changed.我还尝试了数据库缓存 - 没有任何改变。 How can I get this to work?我怎样才能让它工作?

UPD: I can create TaskResult and GroupResult objects manually with django admin panel or django shell, the problem is that they are not created automatically. UPD:我可以使用 django 管理面板或 django shell 手动创建 TaskResult 和 GroupResult 对象,问题是它们不是自动创建的。

You have to migrate first then you will able to store such information.Follow this link you will get your solution for sure:您必须先迁移,然后才能存储此类信息。点击此链接,您肯定会得到您的解决方案:

https://docs.celeryq.dev/en/stable/django/first-steps-with-django.html#django-celery-results-using-the-django-orm-cache-as-a-result-backend https://docs.celeryq.dev/en/stable/django/first-steps-with-django.html#django-celery-results-using-the-django-orm-cache-as-a-result-backend

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM