The {% load %} tag imports template tag modules into a template’s namespace, much like Python’s import statement. Use it when a useful tag lives outside Django’s default tag library. section 7.3
For example, {% static %} is supplied by Django but must be loaded separately. Put {% load static %} near the top of the template, then use {% static 'img/logo.png' %} to produce the file’s URL. section 7.3
Loading static in the RiffMates home page
The template extends base.html, loads the static tag library, and places the generated image URL inside an <img> element. The static file name is relative to the static directory. section 7.3
Listing 7.13 Template for the home page that includes a static file
<!-- RiffMates/templates/home.html -->
{% extends "base.html" %}
{% load static %} #1
{% block content %}
<img src="{% static 'img/logo.png' %}" height="100"> #2
<h1>Welcome to RiffMates!</h1>
<ul> #3
<li> <a href="{% url 'news' %}">News</a> </li>
<li> <a href="{% url 'musicians' %}">Musicians</a> </li>
<li> <a href="{% url 'bands' %}">Bands</a> </li>
<li> <a href="{% url 'venues' %}">Venues</a> </li>
<li> <a href="{% url 'list_ads' %}">Classified Ads</a> </li>
<li> <a href="{% url 'comment' %}">Leave a comment</a> </li>
</ul>
{% endblock content %}
Inspect the complete home-page template showing {% load static %} and its use with the logo image. section 7.3
