1）直接在对象上设置

app.debug=True
app.run()

2)作为run的参数传入进去

app.run(debug=True)

Prior to Flask 1.0 the FLASK_ENV environment variable was not supported and you needed to enable debug mode by exporting FLASK_DEBUG=1. This can still be used to control debug mode, but you should prefer setting the development environment as shown above.