Docker Compose with Django
We'll build a Django project from scratch and get it working locally first. Then we'll Dockerize and get it working with docker-compose.yml
. Found this is more useful and the typical steps folks take to setting up Docker Compose.
Docker Compose Commands
docker-compose build
docker-compose up
docker-compose exec web
More:
docker-compose start
docker-compose stop
Docker Commands
docker build -t boltops/docker-compose-django .
docker run boltops/docker-compose-django
docker push boltops/docker-compose-django
Python Commands Summary
Build Project
django-admin startproject mysite
vim requirements.txt
pip install -r requirements.txt
vim mysite/settings.py # change db, dont forget import os
python manage.py runserver
mysql -uroot -e 'create database mysite_development'
python manage.py migrate
Add polls app
python manage.py startapp polls
vim polls/models.py
vim polls/urls.py
vim mysite/settings.py # install app
python manage.py makemigrations polls
python manage.py sqlmigrate polls 0001
python manage.py migrate
python manage.py shell
Shell Testing
from polls.models import Choice, Question
Question.objects.all()
Question.objects.all().count()
Create admin user
python manage.py createsuperuser
Links:
- GitHub: boltops-learn/docker-compose-django
- Docker Docs: Compose Sample App Django
- Django Docs: Writing Your First Django App
Docker Essentials
1h 46m
1h 46m
Kubernetes Intro
1h 43m
1h 43m
Kubernetes Deploy Tools
48m
48m
Kubes: Kubernetes Deploy Tool
2h 21m
2h 21m
Kubernetes Tips
19m
19m
AWS EKS Kubernetes
4h 13m
4h 13m
Azure AKS Kubernetes
40m
40m
Google GKE Kubernetes
3h 29m
3h 29m
Get full access to these great resources
All for less than the price of coffee a day
44 courses
286 lessons
46+ hours