without a redirect everything works fine, but with this redirect, nothing seems to be working. I've tried updating the code, tried forcing a POST request, check tons of SO posts but found no solution that works for me.
Using Python 3.7 Flask Code:
from flask import Flask, render_template, request, redirect, url_for
app = Flask(__name__)
@app.route('/')
def index():
return render_template("index.html")
@app.route('/', methods=['POST'])
def num_of_students():
num = request.form['text']
return redirect(url_for('test123',num=num))
@app.route('/test123')
def test123():
return render_template("test.html")
if __name__ == "__main__":
app.run(debug=True)
HTML Code Index:
<!doctype html>
<title>Rubric</title>
<label>Welcome to the Autograding Rubric</label>
<p>Please enter the number of students.</p>
<form method="POST">
<input type="text", name="text">
<input type="submit">
</form>
</html>
Test:
<!DOCTYPE html>
<title>Test</title>
<p>Test Var: {{ num }}</p>