Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Getting an invalid block tag message Invalid block tag on line 2: 'out'. Did you forget to register or load this tag? but don't know why. Here's my setup:

graphs.html

{% out %}

views.py

out = 'something to say'
template = loader.get_template('viz_proj/graphs.html')
context = {
    'out' : out
} 
return HttpResponse(template.render(context, request))

settings.py

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'viz_proj'
]

project heirarchy

viz_proj
|
viz_proj----------------------------------------templates
    |                                              |
    settings.py--views.py--urls.py               graphs.html
like image 363
nlr25 Avatar asked Jul 23 '16 02:07

nlr25


People also ask

What does {% %} do in HTML?

html" %} (with quotes) uses the literal value "base. html" as the name of the parent template to extend. {% extends variable %} uses the value of variable .

What are templates in Django?

A Django template is a text document or a Python string marked-up using the Django template language. Some constructs are recognized and interpreted by the template engine. The main ones are variables and tags. A template is rendered with a context.

Is equal in Django template?

If the values of these variable are equal, the Django Template System displays everything between the {% ifequal %} block and {% endifequal %}, where the {% endifequal %} block marks the end of an ifequal template tag.


1 Answers

I think you want to try {{ out }} instead of {% out %}.

like image 177
Chris Jones Avatar answered Oct 05 '22 23:10

Chris Jones