This is a standard django project. It has already completed django tutorial part 1. Docker-compose is refer to official docker quickstart. In addition, you can use remote debug with vscode. Please check this note.
Remote Debug Django3(Docker) with VSCode
- mysql 5.7
- python 3.9
- django 3
$ make build
$ make up
※ If you can't create database called django_sample, you should try to exec make init-db
, make stop
and make up
again.
Open url http://127.0.0.1:8000/polls
Show Hello, world. You're at the polls index.
Use python library ptvsd
Install vscode python library.
Reopen vscode after install.
.
├── .vscode
├── Dockerfile
├── Makefile
├── README.md
├── composeexample
├── docker-compose.yml
├── manage.py
├── mysql
├── polls
└── requirements.txt
$ make up
Attention! Break point can't seem to use some of other files(etc. polls/url.py, manage.py ...). Sorry, I don't know the reason.
Remove comment out L23 after make up
.
Attention! docker container can't start if you remove comment out before make up
ptvsd.enable_attach(address=('0.0.0.0', 3000))
Enter fn + F5
(Mac OS). Under bar color changes from blue to orange.
Reload http://127.0.0.1:8000/polls/, and program will stop break point.