Skip to content

Commit

Permalink
Remove deprecated before_first_request decorator from example
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Mar 4, 2023
1 parent 39407dd commit 6a24b2d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/load/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 6a24b2d

Please sign in to comment.