From 6a24b2d93ea1da0d1c17f104131dfd901c30a24d Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Sat, 4 Mar 2023 11:03:52 +0000 Subject: [PATCH] Remove deprecated before_first_request decorator from example --- examples/load/app.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/load/app.py b/examples/load/app.py index 6d63d4e..63353c0 100644 --- a/examples/load/app.py +++ b/examples/load/app.py @@ -30,13 +30,13 @@ def page2(): return render_template('page2.html') -@app.before_first_request -def before_first_request(): - threading.Thread(target=update_load).start() - - def update_load(): with app.app_context(): while True: time.sleep(5) turbo.push(turbo.replace(render_template('loadavg.html'), 'load')) + + +th = threading.Thread(target=update_load) +th.daemon = True +th.start()