I created a simple Html file and Child html file to test a template inhertance using block
base.html
<h1>TEST BLOCK</h1> {% block content %}{% endblock %}
test.html
{% extends "base.html" %} {% block content %}Output{% endblock %}
I've already reasearch and tried searching so far it didn't solve my issue. The word "Output" won't show
I've a solved already the issue. Please see below for the solution
base.html
<h1>Hello</h1>{% block content %} {% endblock %}
child.html
{% include 'base.html' %}
{% block content %} World {% endblock %}
The issue was in my routing it was routing to the base template when it should've routing to the child template. Since in the child template it will also show the "Hello".
issue:
@views.route('/')
def home():
return render_template('base.html')
solved:
@views.route('/')
def home():
return render_template('child.html')