Django - Deployment and ProductionWhich setting must be added to enable WhiteNoise static file compression?ADEBUG = TrueBSTATIC_ROOT = '/static/'CSTATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'DALLOWED_HOSTS = ['*']Check Answer
Step-by-Step SolutionSolution:Step 1: Identify WhiteNoise compression settingThe setting STATICFILES_STORAGE with value 'whitenoise.storage.CompressedManifestStaticFilesStorage' enables compression and caching.Step 2: Understand other optionsSTATIC_ROOT sets static files folder, DEBUG controls debug mode, ALLOWED_HOSTS controls allowed domains, none enable compression.Final Answer:STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' -> Option CQuick Check:Compression setting = STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' [OK]Quick Trick: Use CompressedManifestStaticFilesStorage for compression [OK]Common Mistakes:MISTAKESSetting STATIC_ROOT instead of STATICFILES_STORAGEConfusing DEBUG or ALLOWED_HOSTS with compression
Master "Deployment and Production" in Django9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Django Quizzes Async Django - When async helps and when it does not - Quiz 7medium Async Django - Why async matters in Django - Quiz 3easy Caching - Cache backends (memory, Redis, Memcached) - Quiz 14medium DRF Advanced Features - Custom serializer fields - Quiz 6medium DRF Advanced Features - Serializer validation - Quiz 9hard Deployment and Production - Database migration in production - Quiz 4medium Django REST Framework Basics - Serializers for data conversion - Quiz 13medium Security Best Practices - Security checklist (manage.py check --deploy) - Quiz 2easy Security Best Practices - Content Security Policy - Quiz 6medium Testing Django Applications - TestCase and SimpleTestCase - Quiz 12easy