风吹佩兰_个人页

个人头像照片 风吹佩兰
个人头像照片
0
1
0

个人介绍

暂无个人介绍

擅长的技术

获得更多能力
通用技术能力:

暂时未有相关通用技术能力~

云产品技术能力:

暂时未有相关云产品技术能力~

阿里云技能认证

详细说明
暂无更多信息
正在加载, 请稍后...
暂无更多信息
  • 回答了问题 2019-07-17

    在ecs上启动flask应用后,无法通过公网ip访问网站

    我也是遇到同样的问题。。还不知道怎么解决


    目前来看,端口设置正确的话, 可能是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)

    踩0 评论0
正在加载, 请稍后...
滑动查看更多
正在加载, 请稍后...
暂无更多信息