Dockerized Django + PostgreSQL project. PostgreSQL runs in its own container and is used internally by the web container. No external DB or mandatory host .env is required if credentials are provided in docker-compose.yml.
- Clone:
git clone https://github.com/ThompsonShell/Contact-control.git
cd Contact-control- Build & run:
docker compose up -d --build- View logs:
docker compose logs -f web
docker compose logs -f db- SQL files in
db/init/are executed by the official Postgres image only on first initialization (when the DB volume is empty). - Check seed data:
docker compose exec db psql -U <POSTGRES_USER> -d <POSTGRES_DB> -c "SELECT * FROM app.sample;"- To force init scripts to run again (WARNING: deletes DB data):
docker compose down -v
docker compose up -d --build- Run migrations:
docker compose exec web python manage.py migrate --noinput- Collect static files:
docker compose exec web python manage.py collectstatic --noinput- Enter web container:
docker compose exec web bash- Create superuser:
python manage.py createsuperuser- Init SQL not applied → existing DB volume:
docker-compose down -vthen bring up again. - Web errors before DB ready → ensure entrypoint waits for DB (e.g.
pg_isready).
- Endpoint testing — suggested test commands and DB checks.
- README writing — this README was drafted with AI help.
- Docker guidance — Dockerfile, docker-compose, entrypoint and init-file usage were advised by AI.