I am new to Flask. I started from some Youtube videos,but somehow mine is not working with the extends part. I am getting the output as if I haven't extended the second HTML file specified below. Am I missing something ?
This is my "main.py" file
from flask import Flask,redirect,url_for,render_template
app = Flask(__name__)
@app.route("/")
def index():
return render_template("home.html")
if __name__=="__main__":
app.run(debug=True)
this is "templates/home.html" file
<!doctype html>
<html lang="en">
<head>
<title>mY Page</title>
</head>
<body>
<h1> this is nav----------- bar</h1>
<hr/>
{% include 'templates/test.html' %}
<div id="content">{% block content %}{% endblock %}</div>
</body>
</html>
and this is 2nd html "templates/test.html"
{% extends 'templates/home.html' %}
{% block content %}
<h1>Index</h1>
<p class="important">
Welcome on my awesome homepage.
{% endblock %}
question from:
https://stackoverflow.com/questions/65867984/i-am-trying-to-extend-a-html-file-in-flask-but-its-not-reflecting-in-output 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…