In this article, I've summarized the commands used in Django + Docker development.
startproject This is the command to start the project.
terminal
#Build and start at the same time
#-The d option means to start in the background
$ docker-compose up -d --build
terminal
$ docker-compose run web django-admin.py startproject project name.
Django's runserver-like command.
terminal
#At the very beginning, type this in and build
$ docker-compose up --build
terminal
$ docker-compose up
It will stop the container and delete the image on the network and volume as well.
terminal
$ docker-compose down --rmi all --volumes
This is the command for creating a new app.
terminal
$ docker-compose run --rm web django-admin startapp app name
terminal
$ docker-compose run --rm web python3 manage.py makemigrations
terminal
$ docker-compose run --rm web python3 manage.py migrate
You will need it to log in to the management screen.
terminal
$ docker-compose run --rm web python3 manage.py createsuperuser
terminal
$ docker system prune -a
terminal
$ docker-compose down -v
I will add it in the future, so I hope it will be helpful.
Recommended Posts