I'm working with a Flask app that has to run an infinite function called session
inside the route /init
. Because session
is infinite, when i have the code lay out like
@app.route('/init', methods=('GET', 'POST'))
def init():
session(stock, batch_size, wait_time)
return render_template('init.html', stock=stock, batch_size=batch_size, wait_time=wait_time)
the template will never get rendered. When I switch session
and the return
function, the template gets rendered but of course session
never runs.
The reason session
has to run infinitely is because it relies on real time info, and thus has to check for new info every wait_time
. I want to be able to run session
and update the HTML using the output (which will change every wait_time
). I am extremely new to web dev, so any help would be greatly appreciated.
If it's any help, here's the full code on GitHub.
Thanks.