comparison 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
comparison
equal deleted inserted replaced
514:6d816aa586c1 515:ae89ba801e8b
4 from decimal import Decimal 4 from decimal import Decimal
5 5
6 import django.utils.simplejson as json 6 import django.utils.simplejson as json
7 from django.contrib.messages import constants as message_constants 7 from django.contrib.messages import constants as message_constants
8 import djcelery 8 import djcelery
9 from celery.schedules import crontab
9 10
10 11
11 PROJECT_PATH = os.path.abspath(os.path.join(os.path.split(__file__)[0], '..')) 12 PROJECT_PATH = os.path.abspath(os.path.join(os.path.split(__file__)[0], '..'))
12 13
13 DEBUG = True 14 DEBUG = True
212 CELERY_DISABLE_RATE_LIMITS = True 213 CELERY_DISABLE_RATE_LIMITS = True
213 CELERY_SEND_TASK_ERROR_EMAILS = True 214 CELERY_SEND_TASK_ERROR_EMAILS = True
214 215
215 djcelery.setup_loader() 216 djcelery.setup_loader()
216 217
218 CELERYBEAT_SCHEDULE = {
219 "potd": {
220 "task": "potd.tasks.pick_potd",
221 "schedule": crontab(minute=0, hour=0),
222 }
223 }
224
217 ####################################################################### 225 #######################################################################
218 # GPP Specific Settings 226 # GPP Specific Settings
219 ####################################################################### 227 #######################################################################
220 GPP_SEND_EMAIL = True 228 GPP_SEND_EMAIL = True
221 GPP_NO_REPLY_EMAIL = 'no_reply' 229 GPP_NO_REPLY_EMAIL = 'no_reply'