无法在 Windows 10 Pro 机器上访问本地 Flask 服务器端点

时间:2021-05-05 03:29:11

标签: python windows flask

在 Windows 10 专业版上运行此代码

from flask import Flask

app = Flask(__name__)

@app.route("/")
def index():
    return "Hello World!"

if __name__ == "__main__":
    app.run(debug=True)

结果如下

** * Serving Flask app "test" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 198-193-169
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
**

但是当我尝试打开此网址时 http://127.0.0.1:5000/ 我在网页上看到以下错误

{"error":"Not found"}

知道为什么这在 Windows 上不起作用吗? 我需要启用任何权限吗?

谢谢

1 个答案:

答案 0 :(得分:1)

有另一个进程在同一个端口上监听。我杀了那个进程,问题就为我解决了

相关问题