flask 相关参数
1.只接受本机的访问,192.168.1.3是本机IP
from flask import Flask app = Flask(__name__) @app.route("/hello") def hello(): return "hello world" app.run(host="192.168.1.3",debug=True)
2.接受其他任意主机的访问
from flask import Flask app = Flask(__name__) @app.route("/hello") def hello(): return "hello world" app.run(host="0.0.0.0",debug=True)
修改端口
from flask import Flask app = Flask(__name__) @app.route("/hello") def hello(): return "hello world" app.run(host="192.168.1.3",debug=True,port=81)