1. 运行参数设置host为0.0.0.0
#!/usr/bin/python
#file: start_flask.py
from flask import Flask
app=Flask(__name__)
@app.route('/')
def hello_world():
return 'hello world'
if __name__=='__main__':
app.run(host='0.0.0.0', port=8080)
2.开放端口8080
firewall-cmd --add-port=8080/tcp
网友评论