Skip to content

Instantly share code, notes, and snippets.

@psychok7
Last active December 17, 2015 10:19
Show Gist options
  • Save psychok7/5594178 to your computer and use it in GitHub Desktop.
Save psychok7/5594178 to your computer and use it in GitHub Desktop.
Using celery periodic tasks with Django
SETTINGS.PY:
from datetime import timedelta
CELERYBEAT_SCHEDULE = {
'add-every-30-seconds': {
'task': 'yourapp.tasks.teste',
'schedule': timedelta(seconds=5),
'args': (16, 16)
},
}
MYAPP.TASKS.PY:
@task(queue='rep_data')
def teste(x,y):
print x+y
#To run:
#python manage.py celery worker
#python manage.py celerybeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment