Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Django Debug Toolbar Visibility and INTERNAL_IPS in Docker Environments #4976

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

DavidPacioianu
Copy link
Contributor

@DavidPacioianu DavidPacioianu commented Apr 8, 2024

Problem: The Django Debug Toolbar does not display in Docker (tested on MacOS) because socket.gethostname() returns Docker's default IP (172.21.0.1), not the host's IP.

Solution: Switch socket.gethostname() to host.docker.internal to accurately reference the host machine's IP from within Docker containers. This change ensures the the host's IP is added to INTERNAL_IPS and the Django debug toolbar is visible when developing in Docker.

DavidPacioianu and others added 3 commits April 8, 2024 14:28
The ip returned by `socket.gethostname()` is default docker `172.21.0.1` ip, which is not the actual IP of the host. Replace `socket.gethostname()` with `host.docker.internal`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants