Bird
0
0

You want to use WhiteNoise with Django and also serve media files from the same app. What is the best approach?

hard📝 Application Q9 of 15
Django - Deployment and Production
You want to use WhiteNoise with Django and also serve media files from the same app. What is the best approach?
ASet MEDIA_URL to STATIC_URL to unify paths
BUse WhiteNoise to serve both static and media files automatically
CUse WhiteNoise for static files and configure separate media serving via Django or web server
DDisable WhiteNoise and serve all files via Django views
Step-by-Step Solution
Solution:
  1. Step 1: Understand WhiteNoise scope

    WhiteNoise is designed for static files, not media files uploaded by users.
  2. Step 2: Best practice for media files

    Serve media files separately via Django development server or dedicated web server in production.
  3. Final Answer:

    Use WhiteNoise for static files and configure separate media serving via Django or web server -> Option C
  4. Quick Check:

    WhiteNoise for static, media served separately [OK]
Quick Trick: Serve media files separately; WhiteNoise is for static only [OK]
Common Mistakes:
MISTAKES
  • Expecting WhiteNoise to serve media files
  • Unifying MEDIA_URL and STATIC_URL incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes