pycharm操作flask的坑

标题pycharm操作Flask的app.run()的坑

我们如果自定义配置了app.run()中debug、host、port直接点击pycharm的运行flask,默认是不会起任何作用的。

avatar

解决办法是有两种:
1.直接在pycharm的终端中运行,修改的配置则生效。但每次需要手动输入命令。

avatar

2.修改pycharm中flask的配置,然后点击pycharm运行就可以了。
首先找到配置

avatar

pycharm 中 python3 的环境编码是 ASCII 转化为utf-8

Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment
If you are trying to execute tests case you must set the following environment variables each time:

export LC_ALL=en_US.utf-8
export LANG=en_US.utf-8
Doing this each time will resolve the error.
It may also be possible to set this in your IDE if you are using one. For example see the following setting in PyCharm 2016.

avatar