John Ingle
John Ingle

Reputation: 9

Flask Error extending html with template: jinja2.exceptions.TemplateSyntaxError: tag name expected

I am doing a basic flask html extension and I have no idea why it is throwing an error. Here is my code:

python code

index html

base html

What syntax error am I missing?

Upvotes: 0

Views: 1376

Answers (2)

Dinko Pehar
Dinko Pehar

Reputation: 6071

In your base.html, it should be {% extends "base.html" %}, not {% {% extends base.html %} %}.

Remove that and you are good to go.

EDIT:

Also, to keep content from base.html, use {{ super() }} as a first line in blocks.

For example:

{% extends "base.html" %}

{% block content %}
    {{ super() }} {# to keep yours h1 tag #}
    ...Additional content to add
{% endblock %}

Upvotes: 1

RobsonGrangeiro
RobsonGrangeiro

Reputation: 11

Dinko is correct. Next time, try use Debug=True and post the output here. It's help to find a error.

See http://flask.pocoo.org/docs/1.0/patterns/templateinheritance/ to more information about Templates.

Upvotes: 1

Related Questions