You need to return the index.html instead of base.html
@app.route('/')
def home():
return render_template('index.html')
Also you nee to extend ‘base.html’ not ‘templates/base.html’ in your index.html file.
You need to return the index.html instead of base.html
@app.route('/')
def home():
return render_template('index.html')
Also you nee to extend ‘base.html’ not ‘templates/base.html’ in your index.html file.
This is my base.html
<html>
<head>
{% block head %}
{% endblock %}
</head>
<body>
Outside Block
{% block body %}
{% endblock %}
</body>
</html>
This is my index.html
{% extends 'templates/base.html' %}
{% block body %}
<h1> Inside Block </h1>
{% endblock %}
My endpoint:
@app.route('/')
def home():
return render_template('base.html')
And my browser displays
Outside Block
Whenever I execute my code everything except the blocks are displayed. I can even display a value by passing it as a parameter and display it as {{value}}
or use an if condition even include
is working. Just the block statements are not working.
What could be the reason for this?