Skip to content

a collection of the most important shortcuts and commands for a django setup with docker

Notifications You must be signed in to change notification settings

chrisrok/django-docker-kubernetes-shortcuts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

django-docker-kubernetes-shortcuts

with docker terminal commands can get really long :). this is a collection of the most important shortcuts and commands for a django setup with docker for daily use.

docker

  • building all containers with docker-compose.yml:
    docker-compose build .

  • building single container (service) with docker-compose.yml:
    docker-compose build <servicename>

  • starting application cluster with docker-compose.yml:
    docker-compose up

  • starting single application with docker-compose.yml:
    docker-compose up <servicename>

django

  • running the shell:
    docker-compose run --rm app sh -c "python manage.py shell"

  • running the shell with ipython (requires additional configuration):
    docker-compose run --rm app sh -c "python manage.py shell_plus --ipython"

  • create superuser:
    docker-compose run --rm app sh -c "python manage.py createsuperuser"

pytest & flake8

  • run tests:
    docker-compose run --rm app sh -c "pytest"

  • check code-style:
    docker-compose run --rm app sh -c "flake8"

database

  • makemigrations:
    docker-compose run --rm app sh -c "python manage.py makemigrations"

  • migrate:
    docker-compose run --rm app sh -c "python manage.py migrate"

pip-compile

  • creating requirements.txt from requirements.in:
    pip-compile -o requirements.txt

code-styling with pre-commit

  • installing (tool requires a .pre-commit-config.yaml):
    pre-commit install

  • check code locally (e.g. flake8) use -a to include all files:
    pre-commit run flake8

deployment (gcloud)

  • authenticate:
    gcloud auth configure-docker

  • get available contexts:
    kubectl config get-contexts

  • switch context:
    kubectl config use-context CONTEXT_NAME

  • authenticate project:
    gcloud container clusters get-credentials --zone [zone] --project [project]

  • get current pods:
    kubectl get pods

  • get logs of a pod:
    kubectl logs <podname>

About

a collection of the most important shortcuts and commands for a django setup with docker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published