Skip to content

AmySalieri/todo-flask-postgres

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Todo-flask-postgresql

Example on how to set up a multi-containers platform using Python-Flask and postgres database

How to set up the environment platform

Start a Postgresql database container

docker run -d -it --name db -e POSTGRES_PASSWORD=password  -p 6432:5432 \
 systemdevformations/postgresql-alpine

Launch a PgAdmin 4 container connected to the Postgresql database

docker run -d --name pgadmin -p 20100:80 --link db:postgres -e PGADMIN_DEFAULT_EMAIL=ambient-it@gmail.com \
-e PGADMIN_DEFAULT_PASSWORD=p4ssw0rd dpage/pgadmin4

In pgAdmin4 set a connection to the postgresql database
create a database named tododb
and run the script ./sql/todos.sql in tododb database

Get this repository
git clone https://github.com/system-dev-formations/todo-flask-postgres.git
Build todo-sql image
cd todo-flask-postgres
docker build -t todo-sql .

After type in your shell console

docker run -it --name todo --link db:todo -p 5000:5000 todo-sql

Test

Bring up your favorite browser
http://localhost:5000/ and check

Docker-compose version

We are going to setup a python virtualenv

On ubuntu

Packages, virtualenv, activate

sudo apt-get install python3
sudo apt-get install python3-pip
sudo apt-get install python3-venv
python3 -m venv venv
source venv/bin/activate

docker-compose set up

pip3 install wheel
pip3 install docker-compose

On Centos

sudo yum install python3
sudo yum install python3-pip
python3 -m venv venv
source venv/bin/activate
pip3 install docker-compose
pip3 install --upgrade pip

Execute

In the directory todo-flask-mysql, hit
docker-compose up
or
docker-compose up -d

About

Example of dockerfile python Web flask and a postgresql12.1 database

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 48.1%
  • HTML 43.7%
  • Dockerfile 8.2%