Bird
0
0

You wrote this Celery setup in your Django project:

medium📝 Debug Q14 of 15
Django - Celery and Background Tasks
You wrote this Celery setup in your Django project:
from celery import Celery
app = Celery('proj')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()
But your tasks are not running. What is the most likely mistake?
AUsing wrong Celery import statement
BNot running a message broker like Redis or RabbitMQ
CMissing @shared_task decorator on tasks
DNot calling app.start() in settings.py
Step-by-Step Solution
Solution:
  1. Step 1: Check broker setup

    Celery needs a running message broker (Redis or RabbitMQ) to send and receive tasks.
  2. Step 2: Analyze other options

    Imports and decorators are correct; app.start() is not required in settings.py; missing broker is common cause.
  3. Final Answer:

    Not running a message broker like Redis or RabbitMQ -> Option B
  4. Quick Check:

    Broker must run for tasks to work [OK]
Quick Trick: Always start Redis or RabbitMQ before Celery workers [OK]
Common Mistakes:
MISTAKES
  • Forgetting to start Redis or RabbitMQ server
  • Assuming Celery works without a broker
  • Misplacing @shared_task decorator

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes