1
0
Fork 0
mirror of https://github.com/docker/awesome-compose.git synced 2025-04-25 18:28:07 +02:00
awesome-compose/flask-redis/app.py

16 lines
329 B
Python
Raw Normal View History

# 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)