
运行app.run(host="127.0.0.1",port=5002,debug=True)
,但是服务启动后,还是默认的ip和端口http://127.0.0.1:5000
,debug模式也是off。
网上查了很多,诸如说flask1.0不支持debug模式,都是些年代久远的问题。
诸如修改pycharm的设置,勾选FLASK_DEBUG,都是治标不治本。

完美、真正的解决方案是:
原因:因为pycharm识别出你是flask项目。你运行时,可以看到一个flask的图标。

解决:
切换为python的运行模式即可。
选择edit configurations....

复制下name和路径:

点+ ,选择python

将刚才复制的name和路径填过来

使用python模式运行,app.run()中的参数生效

网友评论