if __name__ == "__main__" condition with flask/Elastic Beanstalk
My best guess is that adding if __name__ == '__main__' didn't fix anything, but it coincidentally happened to work that time.
I was setting up a simple flask app on AWS with Elastic Beanstalk, but had a bug that would result in a timeout error when visiting the page 

ERROR: The operation timed out. The state of the environment is
  unknown.

when running 'eb create'). Ultimately I fixed it by inserting the standard if __name__ == '__main__': condition before appplication.run() which I had originally excluded.
My question is: Why should the conditional be necessary for Elastic Beanstalk to run the application? I thought the only purpose of __name__ == '__main__' was so that code does not run when used as a module and I don't see why the absence of the conditional would prevent code from running.