daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest Jun 4th, 2017 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Settings
  2.  
  3. CELERY_BROKER_URL = u'amqp://{rabbitmq_user}:{rabbitmq_password}@{rabbitmq_host}:{rabbitmq_port}'.format(
  4.     rabbitmq_user='redacted',
  5.     rabbitmq_password='redacted',
  6.     rabbitmq_host='redacted.amazonaws.com',
  7.     rabbitmq_port='5672'
  8. )
  9.  
  10. CELERY_RESULT_BACKEND = CELERY_BROKER_URL
  11. CELERY_TASK_SERIALIZER = 'msgpack'
  12. CELERY_RESULT_SERIALIZER = CELERY_TASK_SERIALIZER
  13. CELERY_ACCEPT_CONTENT = ['msgpack', 'json']
  14.  
  15. CELERY_DEFAULT_QUEUE = 'celery'
  16. CELERY_QUEUES = (
  17.     Queue('celery', Exchange('celery-dev')),
  18.     Queue('lead', Exchange('lead-dev')),
  19. )
  20.  
  21. # celeryapp.py
  22. from __future__ import absolute_import
  23.  
  24. import os
  25.  
  26. from celery import Celery
  27.  
  28. # set the default Django settings module for the 'celery' program.
  29. os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
  30.  
  31. app = Celery('redacted')
  32.  
  33. # Using a string here means the worker will not have to
  34. # pickle the object when using Windows.
  35. app.config_from_object('django.conf:settings', namespace='CELERY')
  36. app.autodiscover_tasks()
  37.  
  38.  
  39. @app.task(bind=True)
  40. def debug_task(self):
  41.     print('Request: {0!r}'.format(self.request))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top