https://github.com/mirzomumin/flask_app
Flask + Redis
https://github.com/mirzomumin/flask_app
docker docker-compose flask redis
Last synced: 3 months ago
JSON representation
Flask + Redis
- Host: GitHub
- URL: https://github.com/mirzomumin/flask_app
- Owner: mirzomumin
- Created: 2025-04-01T23:28:21.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-01T23:43:32.000Z (over 1 year ago)
- Last Synced: 2025-04-02T00:28:11.796Z (over 1 year ago)
- Topics: docker, docker-compose, flask, redis
- Language: Python
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mini Flask App
The Flask app with Redis - caching service and containerization with Docker
## Structure
```shell
flask_app/
│── .dockerignore # List of Docker ignore folders/files
│── .env-example # Environment variables example
│── .gitignore # List of git ignore folders/files
│── app.py # Flask entry point
│── configs.py # Project configs
│── Dockerfile # Source code of container image
│── docker-compose.yaml # Config for multi-container setup
│── gunicorn.conf.py # Gunicorn server configs
│── requirements.txt # Dependencies
│── README.md # Documentation
```
## Set Up
1. Clone the project repository
```shell
git clone git@github.com:mirzomumin/flask_app.git
```
2. Move to the project directory
```shell
cd flask_app
```
3. Create `.env` file and copy the content of `.env-example` file into it with default parameters.
```shell
cp .env-example .env
```
You can change `.env` file parameters value at any time as you wish.
## Launch project
1. Launch the app with Docker
```shell
docker compose up --build -d
```
## API Endpoints
1. GET /ping → Check flask app liveness
Request
```shell
curl -X 'GET' \
'http://127.0.0.1:5000/ping' \
-H 'accept: application/json' \
-H 'Content-Type: application/json'
```
Response
```shell
{"status":"ok"}
```
2. GET /count → Return visit count
Request
```shell
curl -X 'GET' \
'http://127.0.0.1:5000/count' \
-H 'accept: application/json' \
-H 'Content-Type: application/json'
```
Response
```shell
{"visit_count": 12}
```
## Stop project
1. Stop and remove containers, networks
```shell
docker compose down
```