1
0
Fork 0
mirror of https://github.com/docker/awesome-compose.git synced 2025-04-26 10:43:35 +02:00
awesome-compose/flask-redis/app.py
ajeetraina 3030c1358d Fixed formatting changes
Signed-off-by: ajeetraina <ajeetraina@gmail.com>
2022-03-13 17:02:25 +05:30

14 lines
338 B
Python

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