@app.route('/signup', methods=['POST', 'GET'])
def signup():
    if (request.method == 'POST'):
        name = request.form.get('name')
        username = request.form.get('username')
        password = request.form.get('password')
        confirm = request.form.get('confirm')
        secure_password = sha256_crypt.encrypt(str(password))
        if (password == confirm):
            db.execute('INSERT INTO users(name,username,password) VALUES(:name,:username,:password)', {'name': name, 'username': username, 'password': secure_password})
            db.commit()
            flash('You are registered and can login', 'success')
            return redirect(url_for('signin'))
        else:
            flash('password did not match', 'danger')
            return render_template('signup.html')
    return render_template('signup.html')
@app.route('/signup', methods=['POST', 'GET'])
def signup():
    if (request.method == 'POST'):
        name = request.form.get('name')
        username = request.form.get('username')
        password = request.form.get('password')
        confirm = request.form.get('confirm')
        secure_password = sha256_crypt.encrypt(str(password))
        if (password == confirm):
            db.execute('INSERT INTO users(name,username,password) VALUES(:name,:username,:password)', {'name': name, 'username': username, 'password': secure_password})
            db.commit()
            flash('You are registered and can login', 'success')
            return redirect(url_for('signin'))
        else:
            flash('password did not match', 'danger')
            return render_template('signup.html')
    return render_template('signup.html')