html page not rendering when a GET request is made.

the below code is the '/signup' endpoint

@app.route('/signup',methods = ["GET","POST"])

def signup(): '''triggered when a GET or POST request is sent to "/signup" endpoint''' c = g.db.cursor() if request.method == "GET": if "user" in session: '''meaning user is logged in and in a session''' return redirect('/front')

    '''triggered when GET request is sent to endpoint at renders login page'''
    return render_template("sign_up.html") # why wont you render

'''triggered if POST request'''
username = request.form["username"]
password = request.form["password"]
confirm_password = request.form['confirm_password'] 
if password == confirm_password and is_userName_valid(username) and check_if_password_is_valid(password):
    '''triggered if form data is all valid'''
    c.execute("INSERT INTO users(userName,password) VALUES(%s,%s)",(username,hashpassword(password))) # inserts user into user table
    g.db.commit() # commmits user into table
    return redirect('/login') # redirects to login page 
else:
    return render_template('sign_up.html',context={"message":"Username or Password are not valid"})
/r/learnpython Thread Parent