如何使用Django中的messages框架通过后台作业显示消息?

2024-03-29 01:11:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用Django Background Tasks在我的Django应用程序中运行后台任务,这是从Django模型检查是否超过了特定的截止日期。你知道吗

@background(schedule=10000)
def check_deadline(repeat=30000):
     # Check if deadline has crossed from DB
     # Return the record's title whose deadline has crossed

如果满足条件,则后台任务必须向当前正在查看的任何模板发送消息。我不知道如何从后台任务向模板发送消息。你知道吗


Tags: django模型模板应用程序消息defchecktasks