Created
May 11, 2020 15:52
-
-
Save timothymugayi/ee205e37b3f394f4b4b7693439d758d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import | |
import os | |
from celery import Celery | |
# Below sets the default Django settings module for the 'celery' app. | |
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_celery_site.settings') | |
# Celery() object contains Celery tasks and configurations. | |
app = Celery('django_celery_site') | |
# The defined namespace='CELERY' means all celery-related configuration keys will be loaded | |
# into celery and should start with a prefix CELERY_ | |
app.config_from_object('django.conf:settings', namespace='CELERY') | |
# Load task modules from all registered Django app configs. | |
app.autodiscover_tasks() | |
@app.task(bind=True) | |
def debug_task(self): | |
print('Request: {0!r}'.format(self.request)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment