Locked lesson.
About this lesson
Another way to add style is to use images. In this lesson, we'll explain how to add static images to your project and your pages.
Exercise files
Download this lesson’s related exercise files.
Using Static Image Files.docx57.4 KB Using Static Image Files - Solution.docx
57.8 KB
Quick reference
Using Static Image Files
Adding images to your web site is fairly straightforward with Django.
When to use
Do this whenever you want to add images to your website.
Instructions
Inside your static/resume directory, create a new directory called images. Open a Windows file explorer to that images directory. Drag and drop any images you like into that directory.
To use an image on your website, make sure you have the load static tag on the webpage:
{% load static %}
And then use a static tag inside an HTML img src tag:
<img src="{% static 'resume/images/my_dog.png' %}">
Hints & tips
- Don't forget to {% load static %}
- <img src="{% static 'resume/images/my_dog.png' %}">
Lesson notes are only available for subscribers.