from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def home():
return "Hello World!"
if __name__ == "__main__":
app.run(debug=True)
此檔請放置名為”templates”的資料夾內
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>my website</title>
</head>
<body>
<h1>hello day57 frist challenge</h1>
</body>
</html>
[email protected]('/')
def home():
return "Hello World!"~~
@app.route('/')
def home():
return render_template("index.html")
ex1 修改index.html 部份內容
<body>
<h1>hello day57 frist challenge</h1>
<h1> 5 * 6</h1>
<h1>{{ 5 * 6}}</h1>
</body>
</html>