Skip to content

mirzomumin/flask_app

Repository files navigation

Mini Flask App

The Flask app with Redis - caching service and containerization with Docker

Structure

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
git clone git@github.com:mirzomumin/flask_app.git
  1. Move to the project directory
cd flask_app
  1. Create .env file and copy the content of .env-example file into it with default parameters.
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
docker compose up --build -d

API Endpoints

  1. GET /ping → Check flask app liveness

Request

curl -X 'GET' \
  'http://127.0.0.1:5000/ping' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json'

Response

{"status":"ok"}
  1. GET /count → Return visit count

Request

curl -X 'GET' \
  'http://127.0.0.1:5000/count' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json'

Response

{"visit_count": 12}

Stop project

  1. Stop and remove containers, networks
docker compose down

About

Flask + Redis + Docker

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors