celery.py 395 B

12345678910111213141516
  1. from __future__ import absolute_import
  2. from celery import Celery
  3. from django.conf import settings
  4. app = Celery('proj.celery')
  5. # Using a string here means the worker will not have to
  6. # pickle the object when using Windows.
  7. app.config_from_object('django.conf:settings')
  8. app.autodiscover_tasks(settings.INSTALLED_APPS)
  9. @app.task(bind=True)
  10. def debug_task(self):
  11. print(repr(self.request))