Enable pdb in a docker container (#6159)

Add config changes to docker-compose file to support pdb and update docs
This commit is contained in:
Sarah Clements 2020-03-19 11:07:31 -07:00 коммит произвёл GitHub
Родитель bda34885b1
Коммит fbd8c4cc23
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -41,6 +41,8 @@ services:
- mysql
- redis
- rabbitmq
stdin_open: true
tty: true
frontend:
container_name: frontend

Просмотреть файл

@ -41,3 +41,11 @@ To add a new repository, the following steps are needed:
For more information on adding a new GitHub repository, see
[Adding a GitHub repository](submitting_data.md#adding-a-github-repository).
## Debugging Tools
You can use the Python Debugger ([pdb](https://docs.python.org/3.7/library/pdb.html)) in a Docker container.
After starting a local Treeherder instance using [docker-compose](installation.md#server-and-full-stack-development),
in a separate shell type `docker attach backend`. Then set a breakpoint in your file using either `import pdb; pdb.set_trace()`
or `breakpoint()` (for Python v3.7+). The pdb debugger will start in that shell once the breakpoint has been triggered.
For example, it can be triggered via refreshing the browser (localhost) if the view you're on calls an API with a breakpoint on it.