I have a heavy duty initialization function that I run in my flask app in production. I download a large file which has the latest data I am interested in.
However, this becomes a huge problem while developing this app. Whenever I make code changes in PyCharm, the reload activity calls this initialization function.
How can I make sure to run this function in production environment only, but not in development? I plan to add more complicated initialization logic that performs a host of other activities and checks before application launch. So, a trivial solution like commenting the function call is not what I'm looking for. I want to add some sophisticated logic that validates a lot of settings in productions.