Bird
0
0

Given this production setting snippet:

medium📝 component behavior Q13 of 15
Django - Deployment and Production
Given this production setting snippet:
DEBUG = False
ALLOWED_HOSTS = ['example.com']
STATIC_ROOT = '/var/www/static/'

What happens when you run python manage.py collectstatic?
AStatic files are copied to '/var/www/static/' directory
BStatic files are served automatically by Django
CAn error occurs because DEBUG is False
DStatic files remain in app folders without change
Step-by-Step Solution
Solution:
  1. Step 1: Understand collectstatic command

    It gathers all static files from apps and copies them to STATIC_ROOT for serving.
  2. Step 2: Check STATIC_ROOT setting

    STATIC_ROOT is set to '/var/www/static/', so files copy there on collectstatic.
  3. Final Answer:

    Static files are copied to '/var/www/static/' directory -> Option A
  4. Quick Check:

    collectstatic copies files to STATIC_ROOT [OK]
Quick Trick: collectstatic copies files to STATIC_ROOT folder [OK]
Common Mistakes:
MISTAKES
  • Thinking Django serves static files in production automatically
  • Believing DEBUG affects collectstatic behavior
  • Assuming static files stay in app folders

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes