django 2.1 celery not execute asyncron task

早过忘川 提交于 2019-12-24 23:32:22

问题


i try to execute background function using celery: this is my current code :

from VideoPublish.models import TitleVideo, Videos
from celery.decorators import task
from UploadExpert.celery import app

# Create your views here.

demo_titles =['title1', 'title2', 'title3']


@app.task(ignore_result=True)
def GetTitles(video_id):
    video = Videos.objects.get(pk=video_id)

    for title in demo_titles:
        t = TitleVideo(
            title=title,
            video_id=video.id
            )
        t.save()

this is call function :

GetTitles.delay(video_id=obj.id)

and this is a celery error:

https://gist.github.com/scaltro/cc6152f82b0fbf501af396b8ad812e91

i want to know where i'am wrong, and how i can solve this problem

来源:https://stackoverflow.com/questions/53527918/django-2-1-celery-not-execute-asyncron-task

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!