docker_practice/compose/demo/app/app.py

14 lines
313 B
Go
Raw Normal View History

2017-12-10 11:52:09 +08:00
from flask import Flask
from redis import Redis
app = Flask(__name__)
redis = Redis(host='redis', port=6379)
@app.route('/')
def hello():
count = redis.incr('hits')
return 'Hello World! 访 {} \n'.format(count)
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)