When run this program outputs "Get method was called"
Why is it the html code 1. not running 2. returning a get request (the default)
and not returning a post request when the data is entered? The html seems not to be running at all.
This is the part of the HTML file that has the input:
<div>
<h2>Welcome</h2>
<form action="{{ url_for('login') }}" method="POST">
<input type="text" id="user" name="user" placeholder="Please enter username">
<button>Submit</button>
</form>
</div>
This is the part of the .PY file in question:
@app.route('/', methods=['GET', 'POST'])
def login():
if request.method == 'GET':
return "Get method was called"
else:
user = request.form.get('user')
return redirect(url_for('home'))
return render_template("login.html", user = user)
I am new to python, so I don't know how to beging finding the error.