App loading twice

Every application seems to load twice. I can use any of the examples published on, and when I insert a simple print

if __name__ == '__main__':
    print('starting main')

the console reports
Is there any particular reason in doing so?

That’s just part of the flask debugger process (part of debug=True). When you deploy your app with e.g. gunicorn, it won’t run twice.

Is there a way to switch this off?

Hello @luggie,

According to Chris’s response, you need to disable debug mode for that to happen. :slight_smile:

yep :smiley: I already got this far :'D
I was asking if it possible to disable ‘loading twice’ even in debug mode since the original question is more then 2 years old.