Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andretw/5963704 to your computer and use it in GitHub Desktop.
Save andretw/5963704 to your computer and use it in GitHub Desktop.
This gist is for my post: http://www.andretw.com/2013/07/using-celery-right-now-and-more-best-practices-1.html
pip install celery-with-redis
celery -A tasks worker --loglevel=debug
from tasks import send_email, add
print "my other codes are here."
send_email.delay('my_email@email.com', '1q2w3e4r5t6y7u')
result = add.delay(10, 25)
result.get(timeout=10)
from celery import Celery
celery = Celery('tasks', broker='redis://localhost:6379/0')
@celery.task
def send_email(email, token):
print "sending email..."
print "you can saving a file or log a message here to verify it."
@celery.task
def add(x, y):
return x + y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment