Bird
0
0

Which file is commonly used to define Celery tasks in a Django app?

easy📝 Conceptual Q2 of 15
Django - Celery and Background Tasks
Which file is commonly used to define Celery tasks in a Django app?
Amodels.py
Btasks.py
Cviews.py
Durls.py
Step-by-Step Solution
Solution:
  1. Step 1: Recall Django app file purposes

    models.py defines data models, views.py handles requests, urls.py routes URLs.
  2. Step 2: Identify where tasks go

    tasks.py is the conventional file to define Celery tasks for clarity and organization.
  3. Final Answer:

    tasks.py -> Option B
  4. Quick Check:

    Task file = tasks.py [OK]
Quick Trick: Put Celery tasks in tasks.py for clarity [OK]
Common Mistakes:
MISTAKES
  • Defining tasks in models.py or views.py
  • Confusing URL routing file with task definitions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes