Flask 无法在 127.0.0.1 打开?

问题描述 投票:0回答:1

我正在尝试在 Flask 上运行最基本的应用程序:

from flask import Flask, render_template
import reddit_text_to_speech  # This is a script converted from my Jupyter notebook and intended to be used in def index() once this is resolved.

app = Flask(__name__)

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

app.run(host='0.0.0.0', port=5000)

但是,我在 Chrome 上看到了这个:

无法访问该网站

127.0.0.1 拒绝连接。

根据CMD,看起来正在运行:

我也有 Jupyter Lab 在 http://localhost:8888/ 上运行,但由于它的端口 8888 它不应该冲突?

python flask localhost
1个回答
0
投票

明白了,在 Chrome 上指定端口有效:

http://127.0.0.1:5000

© www.soinside.com 2019 - 2024. All rights reserved.