Ich habe folgende Route, die Werte aus einer vorgelegten FormBad Anforderungsfehler Kolben mit POST-Anfrage
@app.route('/authenticate', methods=["POST"])
def authenticate():
username = request.form['username']
print(username, file = sys.stderr)
password = request.form['password']
email = request.form['email']
models.User.create_user(email, password, username)
return render_template('signup.html')
Das Problem, das ich in renne bekommt ist, dass ich ein Bad Request The browser (or proxy) sent a request that this server could not understand.
bekomme ich, dass ich überprüft habe Ich bekomme die Werte korrekt aus dem Formular, und dass alle Formulare Inhalt enthalten, aber es scheint nicht zu funktionieren.
Hier wird die Vorlage ist, dass die Ansicht
<form action ="/authenticate" method="POST" id="signup">
<fieldset class="form-group">
<label for="InputUsername"> Username </label>
<input type="text" class="form-control" name="username" id="InputUsername" placeholder="Enter username">
</fieldset>
<fieldset class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" name="email"id="exampleInputEmail1" placeholder="Enter email">
<small class="text-muted">We'll never share your email with anyone else.</small>
</fieldset>
<fieldset class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" name="password "id="exampleInputPassword1" placeholder="Password">
</fieldset>
</form>
und hier ist meine Ansicht Klasse, dass die Formulare sind auf
@app.route('/signup')
def login():
return render_template("signup.html")
Sie haben einen Tippfehler: 'name = "Passwort"' hat ein Leerzeichen. – davidism