Bird
0
0

Given this settings.py snippet:

medium📝 component behavior Q13 of 15
Django - Deployment and Production
Given this settings.py snippet:
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
What happens when you run python manage.py collectstatic?
AStatic files are collected but not compressed or hashed
BStatic files are collected and compressed with hashed names for caching
CStatic files are ignored and not collected
DAn error occurs because the storage class is invalid
Step-by-Step Solution
Solution:
  1. Step 1: Understand CompressedManifestStaticFilesStorage

    This storage compresses static files and adds hashes to filenames for better caching.
  2. Step 2: Effect of collectstatic

    Running collectstatic collects all static files, compresses them, and renames with hashes.
  3. Final Answer:

    Static files are collected and compressed with hashed names for caching -> Option B
  4. Quick Check:

    CompressedManifestStaticFilesStorage compresses and hashes = C [OK]
Quick Trick: CompressedManifestStaticFilesStorage compresses and hashes files on collectstatic [OK]
Common Mistakes:
MISTAKES
  • Thinking files are not collected
  • Assuming no compression or hashing happens
  • Believing the storage class causes errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes