Bird
0
0

Which of the following is the correct way to configure static files in Django production settings?

easy📝 Syntax Q3 of 15
Django - Deployment and Production
Which of the following is the correct way to configure static files in Django production settings?
ASTATIC_URL = '/static/' and STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
BSTATIC_URL = '/media/' and MEDIA_ROOT = os.path.join(BASE_DIR, 'static')
CSTATIC_ROOT = '/static/' and STATIC_URL = os.path.join(BASE_DIR, 'staticfiles')
DMEDIA_URL = '/static/' and STATIC_ROOT = os.path.join(BASE_DIR, 'mediafiles')
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct static file settings

    STATIC_URL defines the URL path for static files; STATIC_ROOT defines the folder where static files are collected.
  2. Step 2: Match correct values

    STATIC_URL = '/static/' and STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') correctly sets STATIC_URL to '/static/' and STATIC_ROOT to a folder named 'staticfiles' inside the base directory.
  3. Final Answer:

    STATIC_URL = '/static/' and STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') -> Option A
  4. Quick Check:

    Static files URL and root [OK]
Quick Trick: STATIC_URL is URL path; STATIC_ROOT is folder path [OK]
Common Mistakes:
MISTAKES
  • Mixing MEDIA and STATIC settings
  • Swapping URL and folder variables

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes