awesome-compose/flask-redis/app.py
ajeetraina 2652caaf60 Added Flask/Redis
Signed-off-by: ajeetraina <ajeetraina@gmail.com>
2022-03-13 17:02:25 +05:30

16 lines
329 B
Python

# compose_flask/app.py
from flask import Flask
from redis import Redis
app = Flask(__name__)
redis = Redis(host='redis', port=6379)
@app.route('/')
def hello():
redis.incr('hits')
return 'This webpage has been viewed %s time(s).' % redis.get('hits')
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)