“Flask”报错:”没有这个选项 –debug”

huangapple go评论55阅读模式
英文:

Flask "no such option --debug"

问题

这是在尝试运行Flask应用时发生的情况:

flask run --debug

尝试过:

flask run --debug

期望输出:

 * 调试模式:开启
警告:这是一个开发服务器,请勿在生产环境中使用。请使用生产WSGI服务器。
 * 运行在 http://127.0.0.1:5000
按CTRL+C退出
 * 使用stat重新启动
 * 调试器已激活!
 * 调试器PIN码:272-345-882
英文:

This happens when you try to run flask app using

flask run --debug

Tried:

flask run --debug

Expecting:

 * Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 272-345-882

答案1

得分: 3

更改顺序的简单解决方案是:

flask --debug run

如果您想添加其他标志,可以这样做:

flask --debug run --host=0.0.0.0 --port=8000
英文:

The simple solution to this is to change the order:

flask --debug run

and if you want to add other flags, you can!

flask --debug run --host=0.0.0.0 --port=8000

答案2

得分: 2

I was following the Quickstart guide of flask documentation and faced this error "No such option: --debug"

This solution worked for me.

flask --debug run

Putting --debug before run.

英文:

I was following the Quickstart guide of flask documentation and faced this error "No such option: --debug"

This solution worked for me.

flask --debug run

Putting --debug before run.

答案3

得分: 1

问题是Flask的旧版本。运行pip install --upgrade flask来解决它。

英文:

For me, the issue was an old version of Flask. Running pip install --upgrade flask fixed it.

huangapple
  • 本文由 发表于 2023年4月6日 23:29:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/75951245.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定