Last active
December 17, 2015 10:19
-
-
Save psychok7/5594178 to your computer and use it in GitHub Desktop.
Using celery periodic tasks with Django
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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