python - Run function after Flask server starts -


this question has answer here:

i'm trying run after flask server has started. thing found run thread sleep. how can this?

this not duplicate because need server listen when method want run, executes.

i want notify server sends requests server server listening. problem other server checks if service up.

use before_first_request decorator. run function before first request received. here's example

@app.before_first_request def startup():     conn.execute("create table if not exists users...")     conn.commit()     print("database tables created") 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -