ömer sarı ömer sarı - 1 month ago 15
HTML Question

Invalid block tag : 'endblock'. Did you forget to register or load this tag?

l get stuck in this error. l'm fresh user of

Django
and l m learning it by following steps on Youtube channel. l did everything same but l got this block tag error.
here is layout1 html content:

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>{ % block title %}{% endblock %}</title>
</head>
<body>
{ % block content %} {% endblock %}
</body>
</html>


index html content:

{% extends "layout/layout1.html"%}


{% block title %}The Video page{% endblock %}


{ % block content %}


<h1>This is a html</h1>

<p>This is a p tag</p>

<a href="http://www.noobmovies.com">Click me!</a>
<img src="https://upload.wikimedia.org/wikipedia/en/7/72/Anthony_Raneri.jpg"/>

{% endblock % }


views.py content:

from django.template.response import TemplateResponse


# Create your views here.
def video(request):

return TemplateResponse (request,"video/index.html",{})


how can l handle this problem? as l did double-check to make sure everything is typed same like Youtube channel and normally ,l did not get where l did a mistake.

Answer

Django didn't recognise your starting block tag, because you have a space between the { and the %.

You also have the same error in both start and end tags in the other template file.

Comments