暂无个人介绍
我也是遇到同样的问题。。还不知道怎么解决
目前来看,端口设置正确的话, 可能是flask配置的问题
启动python自带的HTTP服务器 sudo python -m SimpleHTTPServer 5000 ,这样启的网站可以公网访问
而使用flask官方网站上的示例启的服务器,公网不能访问
我的环境是CentOS 7.2 python 2.7 flask是最新版本
flask默认只能本机访问,要让网络上其他机器访问,需要增加host为0.0.0.0
flask官网原文(http://flask.pocoo.org/docs/0.12/quickstart/#a-minimal-application):
Externally Visible Server
If you run the server you will notice that the server is only accessible from your own computer, not from any other in the network. This is the default because in debugging mode a user of the application can execute arbitrary Python code on your computer.
If you have the debugger disabled or trust the users on your network, you can make the server publicly available simply by adding --host=0.0.0.0 to the command line:
flask run --host=0.0.0.0
This tells your operating system to listen on all public IPs.
也可以这样:
app.run(host="0.0.0.0", port=80)