Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Equal-Distribution-maintenance-system/EDMS/EDMS/celery.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
21 lines (15 sloc)
644 Bytes
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
import os | |
from celery import Celery | |
# set the default Django settings module for the 'celery' program. | |
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'EDMS.settings') | |
app = Celery('EDMS') | |
# Using a string here means the worker doesn't have to serialize | |
# the configuration object to child processes. | |
# - namespace='CELERY' means all celery-related configuration keys | |
# should have a `CELERY_` prefix. | |
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(f'Request: {self.request!r}') |