Im a student learning how to use flask and planning to integrate it with Matplotlib ( The graph maker library). I have got inputs from the user and stored them as variables. However, the variables are not callable upon in later code.
This is my code for flask:
@app.route('/', methods = ['POST','GET'])
def upload_file():
global title, x_axis, y_axis
if request.method == 'POST':
f = request.files['file']
if True == allowed_file(f.filename):
f.save(f.filename)
print(f)
if request.method == 'POST':
if request.method == 'POST':
reqform = request.form
#
title = reqform['title']
x_axis = reqform['x_axis']
y_axis = reqform['y_axis']
#
print(title, x_axis, y_axis)
return render_template('uploaded.html') #, title = title, form = reqform, f = f.filename )
I want to call on the variables such as title
,x_axis
, y_axis
in another @app.route to make a graph.
Im not sure if I'm being specific enough, however, any help would be appreciated. Thank you