对于我的应用程序,我需要能够多次发布,因此我想知道如何使POST直接进行多次。另一种选择是将POST复制到另一个URL。 POST的简要说明是here,这是我的代码,它在我的第二个POST方法处中断。
from flask import Flask, render_template, request, redirect
app = Flask(__name__)
@app.route('/')
def index():
return render_template("index.html")
@app.route('/', methods=['POST'])
#POST is where you go AFTER you enter a your form data
def num_of_students():
num = int(request.form['text'])
return render_template("user.html", num=num) #Turns the input into an int so it can be used by the loop, however is displayed as a str for right now.
@app.route('/', methods=['POST'])
def test123():
studentNames = request.form['studentName']
return render_template("text.html", name=studentNames)
if __name__ == "__main__":
app.run(debug=True) #We need Debug on because we are developing it, console will display more information.