move files around

This commit is contained in:
2020-01-15 17:33:40 -06:00
parent 2b9340d951
commit 90b28dac24
7 changed files with 54 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import time
import redis
from flask import Flask
app = Flask(__name__)
cache = redis.Redis(host='redis', port=6379)
def get_hit_count():
retries = 5
while True:
try:
return cache.incr('hits')
except redis.exceptions.ConnectionError as exc:
if retries == 0:
raise exc
retries -= 1
time.sleep(0.5)
@app.route('/')
def hello():
count = get_hit_count()
return 'Hello World! I have been seen {} times.\n'.format(count)