Fixed formatting changes
Signed-off-by: ajeetraina <ajeetraina@gmail.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
## Compose sample application
|
||||
|
||||
### Python/Flask application built using Docker Compose
|
||||
### Python/Flask application using a Redis database
|
||||
|
||||
Project structure:
|
||||
|
||||
@@ -16,7 +16,6 @@ Project structure:
|
||||
[_docker-compose.yml_](docker-compose.yml)
|
||||
|
||||
```
|
||||
version: '2'
|
||||
services:
|
||||
redis:
|
||||
image: redislabs/redismod
|
||||
@@ -61,7 +60,7 @@ flask-redis-web-1 "/bin/sh -c 'python …" web running
|
||||
After the application starts, navigate to `http://localhost:5000` in your web browser or run:
|
||||
```
|
||||
$ curl localhost:5000
|
||||
|
||||
This webpage has been viewed 2 time(s)
|
||||
```
|
||||
|
||||
## Monitoring Redis keys
|
||||
|
@@ -1,4 +1,3 @@
|
||||
# compose_flask/app.py
|
||||
from flask import Flask
|
||||
from redis import Redis
|
||||
|
||||
@@ -8,8 +7,8 @@ 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')
|
||||
|
||||
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)
|
||||
|
Reference in New Issue
Block a user