以下是我的代码-
app = Flask(__name__, template_folder='templates')
run_with_ngrok(app)
@app.route("/")
def index():
return render_template('index.html')
app.run()
我不断收到此错误 - ConnectionRefusedError: [Errno 111] 连接被拒绝
我确实从 ngrok 帐户获取了令牌并将其保存到配置中。显然这对于一年前讨论的案例有效,但对我来说问题仍然存在。
我和你有同样的情况。
您可以尝试使用 pyngrok 代替,如下所示:https://github.com/alloc7260/Project-Snippets/blob/main/run%20a%20web%20application%20(Flask)%20in%20Colab/run_flask_on_google_colab.ipynb .
此外,如果您运行的是 MacOS Monterrey,只需将端口更改为 4999,因为 AirPlay 接收器使用端口 5000。