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) [[email protected]_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
原文地址:https://www.cnblogs.com/meloncodezhang/p/12602398.html
时间: 2024-11-10 10:50:03