Skip to content

Instantly share code, notes, and snippets.

@sikaili99
Last active April 23, 2020 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sikaili99/bc2abc274ddf670028f11dd1688815ca to your computer and use it in GitHub Desktop.
Save sikaili99/bc2abc274ddf670028f11dd1688815ca to your computer and use it in GitHub Desktop.
from celery.schedules import crontab
CELERY_BROKER_URL = 'redis://localhost:6379' #You can also refrence a remote url from e.g heroku
CELERY_TIMEZONE = 'Europe/Warsaw'
HOUR = 0
DAY = 0
# Let's make things happen
CELERY_BEAT_SCHEDULE = {
'send-sms-every-hour': {
'task': 'send-sms',
# There are 4 ways we can handle time, read further
'schedule': 3600.0,
# If you're using any arguments
'args': ('We don't need any',),
},
# Executes every Friday at 6am
'send-notification-on-friday-afternoon': {
'task': 'my_app.tasks.send_notification',
'schedule': crontab(hour=HOUR, day_of_week=DAY),
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment