Spaces:
Sleeping
Sleeping
File size: 526 Bytes
87112c5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 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}') |