debug 模式开启
最近在写python flask 的Waf后台管理界面,想要启用调试模式,发现安装目前网上流行的两种方式均没法在个人Pycharm中打开调试模式。 1)直接在对象上设置 app.debug=True app.run() 1 2 2)做为run的参数传入进去 app.run(debug=True) 1 简单研究了一下后,发现是flask 更新到1.0之后 不支持使用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. 解决办法: Pycharm 2018环境中能够直接右键运行按钮左边下拉菜单的Edit Configurations,勾上Flask_Debug后面的小勾就行了。 linux环境的话直接 export Flask_Debug = 1 就能够了。 总之,只要改变了Flask_Debug的值就能够开启调试模式了,1为开,0 为关