在GCE实例上运行web应用程序

2024-09-27 00:13:40 发布

您现在位置:Python中文网/ 问答频道 /正文

this教程之后,我将学习如何使用virtualenvflask创建restfulpython服务

我创建了一个小的hello worldweb应用程序并执行它:./app.py。 这导致:

* Running on http://127.0.0.1:5000/
* Restarting with reloader

但是当我打开浏览器并输入http://<external ip>:5000,而不是看到hello world时,我得到:

could not connect to <external ip>:5000

我错过了什么?在


Tags: pyipapp应用程序httpflaskhellovirtualenv
1条回答
网友
1楼 · 发布于 2024-09-27 00:13:40

以下信息清楚地说明了您所缺少的:

Running on http://127.0.0.1:5000/

服务器只监听localhost地址,因此它看不到来自其他计算机的连接。如果要使服务器侦听公共接口,则需要按如下方式更改app.run()行:

^{pr2}$

相关问题 更多 >

    热门问题