Randy Tang
Randy Tang

Reputation: 4363

Django: nested template commands

I am following the tutorial of Tango with Django. When I came to this part of writing nested block template commands in about.html:

{% extends 'rango/base.html' %}
{% block title %}About{% endblock %}

{% block bodyBlock %}
  <img src="{% static '/rango/images/pythonDjango.jpg' %}">
{% endblock %}

The system complains with the error message: Invalid block tag: 'static', expected 'endblock'

How should the above nested commands be arranged?

Upvotes: 0

Views: 198

Answers (1)

Johndt
Johndt

Reputation: 4347

The static tag is not loaded into the template. So, at the top of the template, add:

{% load static %}

Everything else with the posted template looks fine.

Upvotes: 4

Related Questions