https://github.com/neilkuan/flask-redis
https://github.com/neilkuan/flask-redis
docker python redis
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/neilkuan/flask-redis
- Owner: neilkuan
- License: apache-2.0
- Created: 2021-02-12T12:58:40.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-12T13:08:24.000Z (over 4 years ago)
- Last Synced: 2025-03-29T02:38:26.264Z (2 months ago)
- Topics: docker, python, redis
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Python Redis Sample
To Use
```bash
git clone https://github.com/guan840912/flask-redis.gitcd flask-redis
docker-compose build
docker-compose up -d
Creating network "flask-redis_default" with the default driver
Creating movie.internal-bookingapp.com ... done
Creating home ... done
Creating redis ... donedocker-compose ps -a
Name Command State Ports
------------------------------------------------------------------------------------------------
home python app.py Up 0.0.0.0:5000->5000/tcp
movie.internal-bookingapp.com python app.py Up 0.0.0.0:55005->5000/tcp
redis docker-entrypoint.sh redis ... Up 0.0.0.0:6379->6379/tcpdocker-compose logs api
docker-compose logs home
docker-compose logs redis
docker-compose ps -a
Stopping redis ... done
Stopping home ... done
Stopping movie.internal-bookingapp.com ... done
Removing redis ... done
Removing home ... done
Removing movie.internal-bookingapp.com ... done
Removing network flask-redis_default
```To Test
```bash
curl http://localhost:5000/home
Welcome to BookingApp - Home Page - on node 857ac76502c3.
Hit count = 145.
Response from movie.internal-bookingapp.com service: b'Welcome to Movie Booking Page Version 1.0 - on node 62cb97297ca1. Hit count = 146'
```## Use Redis Container
```bash
docker network create redislabdocker run -d --network redislab --name redis --rm -p 6379:6379 redis
docker run -it --network redislab --rm redis redis-cli -h redis
redis:6379> ping
PONG
redis:6379> get hits
(nil)
redis:6379> set hits 1
OK
redis:6379> get hits
"1"
redis:6379> exit
```