I\'m using Flask for developing a website and while in development I run flask using the following file:
#!/usr/bin/env python from datetime import datetime
I had the same issue, and I solved it by setting app.debug to False. Setting it to True was causing my __name__ == "__main__" to be called twice.
app.debug
False
True
__name__ == "__main__"