flask怎样调换默许端口和IP

flask怎样调换默许端口和IP

flask不指定host的话flask默许运转在127.0.0.1,端口是:5000 不许被外网和同一个局域网的其余呆板考察,(即使向要被考察须要树立host地方0.0.0.0) from flask import Flask from flask import request app = Flask(__name__) @app.route('/') def index(): user_agent=request.headers.get('User_Agent') return 'user_agent is %s' %user_agent if __name__ == '__main__': app.run( host='0.0.0.0', port= 5000, debug=True ) 不妨窜改上头的端口和长机ip,再启用!