【发布时间】:2017-12-10 01:13:19
【问题描述】:
我做不到,因为我在 django 代码中没有当前正在运行的后台进程的状态。
请求: 我需要知道 celery 后台任务的状态并从那里渲染 html 页面
@task_success.connect
def task_sent_handler3(sender=None,result=None,**kwargs):
# information about task are located in headers for task messages
# using the task protocol version 2.
#info = headers if 'task' in headers else body
tester()
#print('after_task_publish for task id {info[id]}'.format(info="hhhi",))
我尝试了上面的 celery 注释,但我没有返回任何东西。 如果它也返回,我将能够访问局部变量并返回渲染函数
render(request,'page.html') 来自该成功装饰函数
我该如何解决这个问题?
【问题讨论】:
-
在哪里渲染?背景就是这样,在后台。应该为哪个潜在客户呈现 html 页面?
标签: django python-2.7 django-views celery django-celery