Home > Software engineering >  Flask run script after start
Flask run script after start

Time:11-16

Hey trying to get a script to run once flask has been started but before the first request.

Looking at @app.before_first_request method, this seems to wait for a request before running. Another possible option is using the flask_script library. Most likely will end up using this, but wanted to see if anyone had any other suggestion that didn't include needing new libraries.

Cheers,

CodePudding user response:

Put your code here:-

 if __name__ == "__main__":
   #write your code here to execute first when the app run
  • Related