Bird
0
0

Why is it recommended to keep the Celery configuration in a separate celery.py file instead of placing it directly in settings.py?

hard📝 Conceptual Q10 of 15
Django - Celery and Background Tasks
Why is it recommended to keep the Celery configuration in a separate celery.py file instead of placing it directly in settings.py?
ABecause celery.py is required by Celery workers
BBecause settings.py cannot import Celery
CTo prevent Celery from loading Django settings
DTo avoid circular imports and keep configuration modular
Step-by-Step Solution
Solution:
  1. Step 1: Understand import dependencies

    Placing Celery config in celery.py avoids circular import issues between Django and Celery.
  2. Step 2: Benefits of modular config

    It keeps Celery setup separate and clean, improving maintainability.
  3. Final Answer:

    To avoid circular imports and keep configuration modular -> Option D
  4. Quick Check:

    Separate celery.py avoids circular imports [OK]
Quick Trick: Keep Celery config modular to avoid import problems [OK]
Common Mistakes:
MISTAKES
  • Thinking settings.py cannot import Celery
  • Believing celery.py is mandatory file name
  • Assuming celery.py prevents loading Django settings

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes