English 中文(简体)
Celerrybeat-Django的定期任务
原标题:Celerybeat - Periodic tasks with Django

我不确定事情是如何相配的...

I have a app with active campaigns that anounce winners etc, and send out reminders for the campaigns. The campaign is created with django, and in the campaign model I have a field that says notify winners every X day or week or hour. So for this campaign, the winners must be announced every Friday. This is per campaign, there might be several campaigns with different winners and reminder settings.

我不知道该从何开始? 它应该保存模型吗? 但如果你改变某样东西并再次保存模型呢? 它不会再创造另一个任务吗, 然后再发出两个或更多提醒等吗?

最佳回答

Celerybeat 是一个守护者, 它应该< a href=""http://ask.github.com/celery/cookbook/damonizing.html" rel=“ no follow” 运行在背景 中, 永久运行( 与监督者类似) 。 鉴于您最短的提醒延迟时间为一小时, 它应该运行小时任务 。

此项任务应该检查所有运动, 并根据数据库中的数据来决定它应该发送的提醒。 为了让事情更加容易, 我建议您在发送提醒时计算并保存下次发送提醒的时间。 这样, 下次列出要发送的提醒将会像列出所有过期提醒一样容易 。

问题回答

暂无回答




相关问题
How to get two random records with Django

How do I get two distinct random records using Django? I ve seen questions about how to get one but I need to get two random records and they must differ.

Moving (very old) Zope/Plone Site to Django

I am ask to move data from a (now offline) site driven by Plone to a new Django site. These are the version informations I have: Zope Version (unreleased version, python 2.1.3 ) Python Version 2.1....

Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

Flexible pagination in Django

I d like to implement pagination such that I can allow the user to choose the number of records per page such as 10, 25, 50 etc. How should I go about this? Is there an app I can add onto my project ...

is it convenient to urlencode all next parameters? - django

While writing code, it is pretty common to request a page with an appended "next" query string argument. For instance, in the following template code next points back to the page the user is on: &...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

热门标签