Sha256: cb50a826b1ded06e5995b290a59e2f52a6bd49a3fabfc8ff7d381ca6e28e6d6c

Contents?: true

Size: 513 Bytes

Versions: 7

Compression:

Stored size: 513 Bytes

Contents

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)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
roro-0.3.33 lib/roro/stacks/unstoppable_developer_styles/okonomi/languages/python/frameworks/flask/templates/manifest/app.py
roro-0.3.30 lib/roro/stacks/catalog/unstoppable/developer_styles/fatsufodo/stories/flask/templates/stage_one/app.py
roro-0.3.28 lib/roro/stacks/catalog/unstoppable/developer_styles/fatsufodo/stories/flask/templates/stage_one/app.py
roro-0.3.27 lib/roro/stacks/catalog/unstoppable/developer_styles/fatsufodo/stories/flask/templates/stage_one/app.py
roro-0.3.25 lib/roro/stacks/catalog/unstoppable/developer_styles/fatsufodo/stories/flask/templates/stage_one/app.py
roro-0.3.24 lib/roro/stacks/catalog/unstoppable/developer_styles/fatsufodo/stories/flask/templates/stage_one/app.py
roro-0.3.23 lib/roro/stacks/catalog/unstoppable/developer_styles/fatsufodo/stories/flask/templates/stage_one/app.py