[英]Can't access Google Cloud Compute engine external IP to access flask app
i've build a simple flask app on my google cloud GCE instance, but i can't access it from another computer, here's the simple flask app that i've build:我在我的谷歌云 GCE 实例上构建了一个简单的 flask 应用程序,但我无法从另一台计算机访问它,这是我构建的简单 flask 应用程序:
from flask import Flask, render_template, request, json, abort
app = Flask(__name__)
@app.route('/', methods=['GET'])
def heartbeat():
return 'hello'
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)
and when i run the app当我运行应用程序时
and access the external IP of my machine it only said this site can't be reached并访问我机器的外部 IP 它只说无法访问此站点
i have set up a new firewall rule
我设置了新的防火墙规则
but it still not working.
但它仍然无法正常工作。
这是因为您必须将端口更改为 80 而不是 5000
with me it was the silly problem that when you click on the link to the external IP on the GCP console you get send to https://34.##.#.## and that doesn't work but if you go to 34.##.#.##:5000 it did work for me.对我来说,这是一个愚蠢的问题,当您在 GCP 控制台上单击指向外部 IP 的链接时,您会发送到 https://34.##.#.## 并且这不起作用但是如果您去34.##.#.##:5000 它确实对我有用。 Also doing a "curl 34.##.#.##:5000" on linux also works for me
在linux上做一个“curl 34.##.#.##:5000”也对我有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.