0
0
Djangoframework~10 mins

collectstatic for production in Django - Interactive Code Practice

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

Complete the command to collect static files in Django for production.

Django
python manage.py [1]
Drag options to blanks, or click blank then click option'
Arunserver
Bcollectstatic
Cmigrate
Dcreatesuperuser
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'runserver' instead of 'collectstatic'.
Forgetting to run collectstatic before deployment.
2fill in blank
medium

Complete the setting to specify the directory where static files are collected.

Django
STATIC_ROOT = '[1]'
Drag options to blanks, or click blank then click option'
Astatic
Btemplates
Cmedia
Dstaticfiles
Attempts:
3 left
💡 Hint
Common Mistakes
Setting STATIC_ROOT to 'templates' or 'media' folders.
Not setting STATIC_ROOT at all.
3fill in blank
hard

Fix the error in this command to collect static files with no input prompt.

Django
python manage.py collectstatic [1]
Drag options to blanks, or click blank then click option'
A--force
B--input
C--noinput
D--quiet
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--input' which does not exist.
Forgetting to add '--noinput' in automated scripts.
4fill in blank
hard

Fill both blanks to define static files URL and directory in Django settings.

Django
STATIC_URL = '[1]'
STATIC_ROOT = '[2]'
Drag options to blanks, or click blank then click option'
A/static/
B/media/
Cstaticfiles
Dmediafiles
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up STATIC_URL and STATIC_ROOT values.
Using '/media/' for STATIC_URL instead of '/static/'.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that collects file sizes for static files larger than 1000 bytes.

Django
file_sizes = {file: os.path.getsize(file) for file in static_files if os.path.getsize(file) [1] [2] and file.endswith('[3]')}
Drag options to blanks, or click blank then click option'
A>
B1000
C.css
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' for size comparison.
Using wrong file extension like '.js' instead of '.css'.