Recall & Review
beginner
What are static files in Django?
Static files are files like CSS, JavaScript, and images that don’t change dynamically and are served as they are to the browser.
Click to reveal answer
beginner
How does Django serve static files during development?
Django automatically serves static files when DEBUG is True using the built-in static files app, so you don’t need extra setup for development.
Click to reveal answer
intermediate
What setting tells Django where to find static files in your project?
The STATICFILES_DIRS setting lists folders where Django looks for static files during development.
Click to reveal answer
beginner
What is the purpose of the {% static %} template tag in Django?
The {% static %} tag helps you write URLs for static files in templates, so Django can find and serve them correctly.
Click to reveal answer
intermediate
Why should you not use Django’s static file serving in production?
Django’s static file serving is slow and not secure for production. Instead, use a web server like Nginx or a CDN to serve static files.
Click to reveal answer
Which setting controls whether Django serves static files automatically during development?
✗ Incorrect
When DEBUG is True, Django serves static files automatically during development.
What does the STATICFILES_DIRS setting do?
✗ Incorrect
STATICFILES_DIRS tells Django which folders to search for static files during development.
Which template tag is used to link to static files in Django templates?
✗ Incorrect
You must load the static template tag library with {% load static %} and then use {% static 'path/to/file' %}.
Where should you place your static files in a Django app for development?
✗ Incorrect
Static files belong in a folder named static inside each app or in directories listed in STATICFILES_DIRS.
Why is it recommended to use a web server like Nginx for static files in production?
✗ Incorrect
Web servers like Nginx handle static files efficiently and securely, unlike Django’s development server.
Explain how Django handles static files during development and what settings are important.
Think about how Django finds and serves CSS or images when you run the development server.
You got /4 concepts.
Describe why Django’s static file serving is not suitable for production and what should be done instead.
Imagine your website gets many visitors; how do you serve images and styles fast and safely?
You got /4 concepts.