-1

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,

Vernon
  • 3
  • 2

1 Answers1

0

Put your code here:-

 if __name__ == "__main__":
   #write your code here to execute first when the app run
Fasil K
  • 473
  • 4
  • 17
  • that was blatantly obvious thanks for clarifying that, you'd think there would have been more threads suggesting this. – Vernon Nov 16 '21 at 09:27