- create postgreas database in docker
docker run --name postgres -d -p 5432:5432 -e POSTGRES_PASSWORD=password postgres:alpine
- delete old database and copy data from
.sql
file to the postgres database
docker cp db.sql postgres:/tmp/db.sql
docker exec -it postgres /bin/bash
psql -h localhost -U postgres
DROP DATABASE testdb5;
CREATE DATABASE testdb5;
\q
PGPASSWORD=password psql -h localhost -U postgres -d testdb5 < /tmp/db.sql
- copy the secrets file
cp example-secrects.py secrects.py
- install python env and requirements
python3 -m venv env source env/bin/activate pip install -r final_req.txt
pull the code
git pull
activate the env
source env/bin/activate
migrate the database
python manage.py migrate
run the server
python manage.py runserver
- open remote container Ctrl + Shift + P => Remote Containers: open folder in container
docker cp db.sql begoodplus4_devcontainer_db_1:/tmp/db.sql docker exec -it begoodplus4_devcontainer_db_1 /bin/bash DROP DATABASE testdb5; CREATE DATABASE testdb5; \q PGPASSWORD=password psql -h localhost -U postgres -d testdb5 < /tmp/db.sql
open BegoodPlus4 project
open Docker
and run postgress
start env: .\env\Scripts\activate
cd .\begoodPlus\
python .\manage.py runserver