腾讯云服务器部署flask:一

app.py

from flask import Flask,jsonify
app = Flask(__name__)

app.route("/index")
def index():
    print("进入函数")
    return "hello world"


if __name__ == '__main__':
    app.run(debug=True,host="0.0.0.0")

不能访问

 原因一:防火墙未关闭

service firewalld stop  关闭防火墙

systemctl status firewall  状态为关闭状态

(flask_mini) [root@VM_0_13_centos order]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

 原因二:云服务器的安全组,为开启5000端口

# TODO

猜你喜欢

转载自www.cnblogs.com/meloncodezhang/p/12602398.html