from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
<html>
<head>
<title>{{title}}</title>
</head>
<body>
{% block body %}{% endblock %}
</body>
</html>
{% extends "layout.html" %}
{% block body %}
Hello {{user_name}}
{% endblock %}
class example:
def GET(self):
context = {
"title" : "Example page",
"user_name" : "Billjoy"
}
return render_template("template.html", **context)