(see the cursor).
I think this is because in your login.html file, you have the attribute misspelled. It should be method="post", not methods="post".
Hope this helps!
Run it once, stop the program and then remove these lines.
This creates a user with username abc and password abc.
I said to remove them as once you have the key existing, you don’t need to do it again. It might cause some problems later.
Also in login.html, close the input tags:
<p> Username: <input type ="text" name="username" required></p>
<p> Password: <input type ="password" name="password" required></p>
Done! Problem solved!
Now i will also show how to identify this and fix this yourself:
Once you get an error, look at the console. Here is the error:
Usually, the the last few lines only matters. The last lines say us that there was a KeyError and also showed us the line. It says that the key “users” doesnt exist. So make the key.
Sidenote:
I saw you reading a HTML file and returning the code as a string. Instead of that, use this: import the function
from flask import render_template
use it
@app.route("/")
def page():
return render_template("login.html") #actual path templates/login.html is not specified since templates folder is checked by default
And put login.html in the template folder: templates/login.html
A quick google search says that 302 means the resource requested has been temporarily moved. Which means that something is redirecting that request for some reason.