https://github.com/joel-hanson/django-docker-pdb
An example that demonstrates how to add a breakpoint to Django projects within a Docker
https://github.com/joel-hanson/django-docker-pdb
breakpoint django django-rest-framework python
Last synced: about 1 month ago
JSON representation
An example that demonstrates how to add a breakpoint to Django projects within a Docker
- Host: GitHub
- URL: https://github.com/joel-hanson/django-docker-pdb
- Owner: Joel-hanson
- Created: 2019-08-17T12:21:45.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-31T17:12:33.000Z (over 2 years ago)
- Last Synced: 2024-06-11T18:24:59.353Z (about 2 years ago)
- Topics: breakpoint, django, django-rest-framework, python
- Language: Python
- Homepage:
- Size: 12.7 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# django_docker_pdb
Companion repository to https://joel-hanson.medium.com/how-to-use-pdb-for-django-inside-a-docker-12c424d880ec
## Set up
```bash
# Clone this repository
$ git clone git@github.com:Joel-hanson/django-docker-pdb.git
# Build Docker containers
$ docker-compose up --build
```
## Demonstrating accessing PDB containers
Requests to the site root are handled by a function that contains a [Python pdb statement](https://docs.python.org/3/library/pdb.html). This provides a breakpoint to code execution.
To drop into this breakpoint:
```bash
# Attach into the container
$ docker attach django-docker-pdb_web_1
# Make a request to http://localhost
# You will see the breakpoint visible in your terminal
```