我一直试图将index.html结构扩展到其他html页面,并且我使用了模板继承的概念。不幸的是,由于模板没有从我指向的索引html文件扩展结构,因此我似乎难以实现该目标。任何可以帮助我了解可能出问题的地方的指针。
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>EDS-API</title>
<link rel="stylesheet" href="../static/main.css">
<script src="https://kit.fontawesome.com/cb28e3fd76.js"></script>
</head>
<body>
<nav class="navigation">
<div class="sidebar">
<h2>EDS</h2>
<ul>
<li><a href="login.html"><i class="fas fa-user"></i>Profile</a></li>
<li><a href="#"><i class="fas fa-cog"></i>Operations</a></li>
<li><a href="#"><i class="fas fa-file-medical-alt"></i>Claims</a></li>
<li><a href="#"><i class="fas fa-tachometer-alt"></i>Dashboard</a></li>
</ul>
</div>
</nav>
<div class=main_content>
<header class="main_header">
<div>EDS - Kickstart the engine and roll away.</div>
</header>
<section class="main_body">
<div>EDS - API</div>
</section>
</div>
{% block content %}{% endblock %}
</body>
</html>
Claims.html
{% extends "index.html" %}
{% block content %}
<h3> Claims Data </h3>
{% endblock %}
app.py
from flask import Flask,render_template
app = Flask(__name__)
@app.route("/")
def index():
return render_template('index.html')
@app.route("/claims")
def claims():
return render_template('claims.html')
if __name__ == "__main__":
app.run(debug=True)