我正在尝试在render_template
中的Flask中使用URL参数。当操作发生时,不会发送该参数。这是为了让create_account
显示错误。
@app.route("/new_account", methods=['POST', 'GET'])
def new_account():
return render_template("new_account.html")
@app.route("/create_account", methods=['POST', 'GET'])
def create_account():
user = request.form['username']
pw = request.form['password']
email = request.form['email']
check_user = connectDB.conUser(user=user)
check = ''
if email[-14:] != '@companyname.com':
check += '1'
if len(pw) < 8:
check += '2'
if check_user != []:
check = '3'
if check != '':
print(check)
return render_template("new_account.html", error=check)
else:
return home()
我希望看到类似127.0.0.1/new_account.html?error=12
的URL。