我刚刚开始学习Flask
,但我什至无法完成这个初学者步骤。我试图制作dynamic URL
如下路线,但是当我去http://127.0.0.1:5000/home例如,它说"NOT FOUND"
。任何帮助表示赞赏!
from flask import Flask
app = Flask(__name__)
@app.route("/") #this is the default domain
def home():
return "<h1>Hello this main page</h1>"
@app.route("/<name>")
def user(name):
return f"hi {name}"
if __name__ == "__main__":
app.run()