12345678910111213141516171819202122232425262728 |
- from flask import Flask
- import py_eureka_client.eureka_client as eureka_client
- app = Flask(__name__)
- def setEureka():
- server_host = "localhost"
- server_port = 5000
- eureka_client.init(eureka_server="http://localhost:5100/eureka/",
- app_name="flask_server",
-
- instance_host=server_host,
- instance_port=server_port,
-
- ha_strategy=eureka_client.HA_STRATEGY_RANDOM)
- setEureka()
- @app.route('/')
- def hello_world():
- return 'Hello World!'
- if __name__ == '__main__':
- app.run(debug=True, threaded=True, port=5000, host="0.0.0.0")
|