mirror of
https://github.com/yeasy/docker_practice.git
synced 2024-11-16 19:43:41 +00:00
14 lines
313 B
Go
14 lines
313 B
Go
|
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)
|