The solution (or at least the first step :-) is actually to not have that line at all. app.run
tells Flask to create a web server of its own, but PythonAnywhere provides a web serving environment for you. If you call app.run
from inside a PythonAnywhere hosted web app, it will just hang because your code is trying to serve its own website and is never relinquishing control to the PythonAnywhere system.
So, if you can, just remove the app.run
line. If you want code that will work on your own computer but also on PythonAnywhere, you can guard it with an if statement that checks whether the web app is being run from a command line, or from inside another application, like this:
if __name__ == "__main__":
app.run(host='0.0.0.0', debug=False)
Give that a go and let us know how you get on.