Spesification :
- Linux Debian 11 (Bullseye)
- Python 3.11.4
- PostgreSQL 15.3
- Django 3.2.19
- Redis 7.2/latest
Several files that needed to be configured :
- ./.env
- ./requirements.txt
- ./src/settings.py
How to run docker django app
- Build docker image
docker-compose build
- Run docker container
docker-compose up -d
- Create database
docker-compose exec web python manage.py migrate
- Create superuser
docker-compose exec web python manage.py createsuperuser
- Collect static files
docker-compose exec web python manage.py collectstatic
- Run django app
docker-compose exec web python manage.py runserver
- Open browser and type the url addres : http://localhost or http://localhost:8080
That's it! & Good luck!
by mazjohn.com
References:
https://github.com/docker/awesome-compose/tree/master/official-documentation-samples/django