An example for docker remote debug with pydevd
or ptvsd
cd $PROJECT_HOME
# ensure you have docker installed
# if pydevd
# start the debug server in your eclipse
docker-compose up
# if ptvsd
poetry export -f requirements.txt --dev --without-hashes --output requirements.txt
docker-compose up
# attach to port 3000 in docker, refer to .vscode/launch.json#`Remote Django App` section
# pay attention to `request`, `pathMappings`, `port`, `justMyCode` attributes
launch `Remote Django App` in vscode debug menu
# attact docker container shell to see more
docker container ls
docker exec -it $CONTAINER_NAME or $CONTAINER_ID sh
open 'http://localhost:8090'
# you should see an 'ok' message
- You will need to edit manage.py (refer to
pydevd_manage.py
) - You will need to find out your dev host ip where your eclipse is running on
- You will need to add
environment
entryPATHS_FROM_ECLIPSE_TO_PYTHON
todocker-compose.yml
- You will need to edit manage.py (refer to
ptvsd_manage.py
) - You will need to edit
launch.json
withjustMyCode=False
to see allsite-packages
codes when debug - You will need to add
3000:3000
toports
indocker-compose.yml