diff gpp/settings/base.py @ 515:ae89ba801e8b

For #194, convert the POTD management command to a celery task. Refactored to put the logic for the command into a function, and the command simply calls this function. The task can also just call this function. Added some basic tests for the new function.
author Brian Neal <bgneal@gmail.com>
date Wed, 14 Dec 2011 02:41:15 +0000
parents 6d816aa586c1
children beda97542da8
line wrap: on
line diff
--- a/gpp/settings/base.py	Tue Dec 13 02:37:50 2011 +0000
+++ b/gpp/settings/base.py	Wed Dec 14 02:41:15 2011 +0000
@@ -6,6 +6,7 @@
 import django.utils.simplejson as json
 from django.contrib.messages import constants as message_constants
 import djcelery
+from celery.schedules import crontab
 
 
 PROJECT_PATH = os.path.abspath(os.path.join(os.path.split(__file__)[0], '..'))
@@ -214,6 +215,13 @@
 
 djcelery.setup_loader()
 
+CELERYBEAT_SCHEDULE = {
+    "potd": {
+        "task": "potd.tasks.pick_potd",
+        "schedule": crontab(minute=0, hour=0),
+    }
+}
+
 #######################################################################
 # GPP Specific Settings
 #######################################################################