django 2.1 celery无法执行异步任务

时间:2018-11-28 20:52:23

标签: django celery djcelery

我尝试使用celery执行后台功能:这是我当前的代码:

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()

这是调用函数:

GetTitles.delay(video_id=obj.id)

这是芹菜错误:

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

我想知道我在哪里错了,以及如何解决这个问题

0 个答案:

没有答案