ich durch den Kolben Tutorial leiten, und ich kann nicht scheinen, die Template-Vererbung zur Arbeit zu kommen. nachstehenden Beispiele meines Codes sindKolben Vorlage Vererbung Tutorial
Mein base.html ist:
<!DOCTYPE html>
<html lang="en">
<head>
{% block head %}
<link rel="stylesheet" href="style.css" />
<title>{% block title %}{% endblock %} - My Webpage</title>
{% endblock %}
</head>
<body>
<div id="content">{% block content %}{% endblock %}</div>
<div id="footer">
{% block footer %}
© Copyright 2008 by <a href="http://domain.invalid/">you</a>.
{% endblock %}
</div>
</body>
</html>
mein Kind Temp ist:
{% extends "base.html" %}
{% block title %}Index{% endblock %}
{% block head %}
{{ super() }}
<style type="text/css">
.important { color: #336699; }
</style>
{% endblock %}
{% block content %}
<h1>Index</h1>
<p class="important">
Welcome to my awesome homepage.
</p>
{% endblock %}
mein Kolben-Skript ist:
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def home():
return render_template("base.html")
if __name__ == "__main__":
app.debug = True
app.run()
Gibt es etwas speziell soll ich in Bezug auf tun, wie es das Kind Vorlage bin enthalten? Oder sollte ich die Basisvorlage anders rendern?