import os from celery import Celery # Set the default Django settings module os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'your_project_name.settings') # Create Celery app app = Celery('your_project_name') # Load config from Django settings with CELERY_ prefix app.config_from_object('django.conf:settings', namespace='CELERY') # Auto-discover tasks from all installed apps app.autodiscover_tasks() @app.task(bind=True) def debug_task(self): """Debug task to test Celery""" print(f'Request: {self.request!r}')