Recall & Review
beginner
What is the purpose of static files in Django templates?
Static files are used to add styles, images, and scripts to web pages. They make the page look good and interactive.
Click to reveal answer
beginner
How do you load static files in a Django template?
You add {% load static %} at the top of the template to tell Django you want to use static files.
Click to reveal answer
beginner
How do you reference a CSS file named 'style.css' located in the static folder inside a Django template?
Use
<link href="{% static 'style.css' %}" rel="stylesheet"> inside the <head> section.Click to reveal answer
intermediate
Why should you use the {% static %} template tag instead of hardcoding file paths?
Because {% static %} automatically finds the correct path to static files, even if you change settings or deploy to another server.
Click to reveal answer
beginner
Where do you place static files in a Django project by default?
Static files go inside a folder named 'static' within your app or project directory.
Click to reveal answer
Which template tag do you use to load static files in Django templates?
✗ Incorrect
You must use {% load static %} at the top of your template to enable static file usage.
How do you correctly reference an image named 'logo.png' in a Django template?
✗ Incorrect
Use {% static 'filename' %} inside the src attribute to get the correct path.
Where should you put your CSS files in a Django project to use them as static files?
✗ Incorrect
CSS files belong in the static folder so Django can serve them as static content.
What happens if you forget to add {% load static %} in your template but use {% static %} tag?
✗ Incorrect
You must load the static tag library first, or Django will raise an error.
Why is it better to use {% static %} instead of hardcoding '/static/' in URLs?
✗ Incorrect
Using {% static %} makes your code flexible and works in different environments.
Explain how to include a static CSS file in a Django template from start to finish.
Think about where the file goes, what you load, and how you reference it.
You got /3 concepts.
Describe why using the {% static %} tag is important when working with static files in Django templates.
Consider what happens if you move your project or change settings.
You got /4 concepts.