Guest User

Untitled

a guest
Feb 20th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. from __future__ import absolute_import
  2. import os
  3. from celery import Celery
  4. from django.conf import settings
  5.  
  6. os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'path to your settings file')
  7. app = Celery('your app name')
  8.  
  9. app.config_from_object('django.conf:settings')
  10. app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
  11.  
  12.  
  13. @app.task(bind=True)
  14. def debug_task(self):
  15. print('Request: {0!r}'.format(self.request))
Add Comment
Please, Sign In to add comment