I have a Flask app that takes in user input and then passes that input along to other functions in the program. My problem is that the other functions will not run unless I close out of the Flask and shut down the server. How would I keep the server up and call the functions? Essentially once the user hits 'submit' I want all the functions to run.
Starting the flask app
app.run(host = '127.0.0.1', threaded = True)
Passing variables into HTML form input
@app.route('/server_app', methods=["POST"])
def server_app():
global set_freq, set_center_freq
set_freq = request.values.get("set_freq") # <--- do whatever you want with that value
set_center_freq = request.form.get("set_center_freq")
return render_template("main_page.html")
Test function is then called, all it does for now is print one of the variables, but it won't run until I use control c and close out of the server.
def test_fun(set_freq):
print(set_freq)
#main
app.run(host = '127.0.0.1', threaded=True)
test_fun(set_freq)
it only runs 'test_fun' once I manually stop the flask server from running.