Flask Gunicorn app can’t get __name__ to equal ‘__main__’

Python sets __name__ to "__main__" when the script is the entry point for the Python interpreter. Since Gunicorn imports the script it is running that script will not be the entry point and so will not have __name__ set to "__main__".

Leave a Comment