Flask 1.0.2 在哪里设置调试模式呢?那位大神晓得呢?网上的方法试了很多种都不行,我是在 win10 操作系统。谢谢
1
saulshao 2018-10-25 00:06:17 +08:00
这是 Visual studio code 中 Launch.JSON 文件的配置片段:
{ "name": "Python: Flask (0.11.x or later)", "type": "python", "request": "launch", "module": "flask", "env": { //"FLASK_APP": "${workspaceFolder}/microblog.py" "FLASK_APP": "microblog.py", "FLASK_DEBUG": "1" }, "args": [ "run", //"--no-debugger", //"--no-reload" ] }, 在上述的片段中,我猜想"FLASK_DEBUG"是关键. Flask 的官方网站是这么说的: To switch Flask to the development environment and enable debug mode, set FLASK_ENV: $ export FLASK_ENV=development $ flask run (On Windows, use set instead of export.) Using the environment variables as described above is recommended. While it is possible to set ENV and DEBUG in your config or code, this is strongly discouraged. They can ’ t be read early by the flask command, and some systems or extensions may have already configured themselves based on a previous value. 原文请参考 http://flask.pocoo.org/docs/1.0/config/ |
2
duzhonglin OP 非常感谢,官网这个我也设置了没有效果的,我是以管理员的身份打开 Power shell, set FLASK_ENV=development。这样也没有效果的
|
3
alphadog619 2018-10-25 09:06:03 +08:00
|
5
duzhonglin OP @vipppppp 我是用的 vscode
|
6
duzhonglin OP @alphadog619 谢谢,我晚上回去试试
|