-
你的@app。路线似乎缺少一个参数,你想按要求做吗
@app.route("/comment/create/<chirp_id>", methods = ["GET", "POST"])
-
尝试将href更改为
<a class="btn btn-success" href="{{ url_for('createCmt', chirp_id='{}'.format(chirp[0])) }}"> + Comment </a>
附加编辑
我试着运行它我做到了
a href的路线
@app.route("/test")
def testing():
return render_template("testerer.html", chirp_id = 123)
去邮局的路线
@app.route("/comment/create/<chirp_id>", methods = ["GET", "POST"])
def createCmt(chirp_id):
return f"{chirp_id}"
HTML
<a class="btn btn-success" href="{{ url_for('createCmt', chirp_id='{}'.format(chirp_id) ) }}"> + Comment </a>