celery.py 733 B

123456789101112131415161718192021
  1. """ configures celery for task management """
  2. from __future__ import absolute_import, unicode_literals
  3. import os
  4. from celery import Celery
  5. from . import settings # pylint: disable=unused-import
  6. # set the default Django settings module for the 'celery' program.
  7. os.environ.setdefault("DJANGO_SETTINGS_MODULE", "celerywyrm.settings")
  8. app = Celery("celerywyrm")
  9. # Using a string here means the worker doesn't have to serialize
  10. # the configuration object to child processes.
  11. # - namespace='CELERY' means all celery-related configuration keys
  12. # should have a `CELERY_` prefix.
  13. app.config_from_object("django.conf:settings", namespace="CELERY")
  14. # Load task modules from all registered Django app configs.
  15. app.autodiscover_tasks()