Indentation seems to be messed up in the last few lines. You need to move the if __name__ == '__main__'
... block out of the create_app
function.
# imports here...
# class and function definitions..
if __name__ == '__main__':
from werkzeug.serving import run_simple
app = create_app()
run_simple('127.0.0.1', 5000, app, use_debugger=True, use_reloader=True)