0
0
Djangoframework~10 mins

STATIC_URL and STATICFILES_DIRS in Django - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the URL prefix for static files in Django settings.

Django
STATIC_URL = '[1]'
Drag options to blanks, or click blank then click option'
A/media/
B/static/
C/assets/
D/files/
Attempts:
3 left
💡 Hint
Common Mistakes
Using '/media/' which is for user-uploaded files, not static files.
Omitting the trailing slash which can cause URL issues.
2fill in blank
medium

Complete the code to add a directory named 'assets' inside the project root to the static files directories.

Django
STATICFILES_DIRS = [BASE_DIR / '[1]']
Drag options to blanks, or click blank then click option'
Aassets
Bmedia
Cstaticfiles
Dstatic
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing 'media' with static files directory.
Using a folder name that does not exist in the project.
3fill in blank
hard

Fix the error in the STATICFILES_DIRS setting to correctly include the 'static' folder inside the project root.

Django
STATICFILES_DIRS = [BASE_DIR [1] 'static']
Drag options to blanks, or click blank then click option'
A/
B+
C*
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' which concatenates strings but does not work with Path objects.
Using '*' or '-' which are invalid for path joining.
4fill in blank
hard

Fill both blanks to create a STATICFILES_DIRS list with two folders: 'assets' and 'extra_static' inside the project root.

Django
STATICFILES_DIRS = [BASE_DIR / '[1]', BASE_DIR / '[2]']
Drag options to blanks, or click blank then click option'
Aassets
Bextra_static
Cmedia
Dstaticfiles
Attempts:
3 left
💡 Hint
Common Mistakes
Including 'media' which is not for static files.
Using folder names that do not exist.
5fill in blank
hard

Fill all three blanks to set STATIC_URL to '/static/', and include 'static' and 'assets' folders in STATICFILES_DIRS inside the project root.

Django
STATIC_URL = '[1]'
STATICFILES_DIRS = [BASE_DIR / '[2]', BASE_DIR / '[3]']
Drag options to blanks, or click blank then click option'
A/media/
Bstatic
Cassets
D/static/
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up '/media/' with '/static/' for STATIC_URL.
Including wrong folder names in STATICFILES_DIRS.