mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-09 06:24:52 +03:00
Fix adding host ip to INTERNAL_IPS when using Docker
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`.
This commit is contained in:
parent
681c13e0fa
commit
c50ca2bf3f
|
@ -73,7 +73,7 @@ INTERNAL_IPS = ["127.0.0.1", "10.0.2.2"]
|
||||||
if env("USE_DOCKER") == "yes":
|
if env("USE_DOCKER") == "yes":
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
hostname, _, ips = socket.gethostbyname_ex(socket.gethostname())
|
hostname, _, ips = socket.gethostbyname_ex("host.docker.internal")
|
||||||
INTERNAL_IPS += [".".join(ip.split(".")[:-1] + ["1"]) for ip in ips]
|
INTERNAL_IPS += [".".join(ip.split(".")[:-1] + ["1"]) for ip in ips]
|
||||||
{%- if cookiecutter.frontend_pipeline in ['Gulp', 'Webpack'] %}
|
{%- if cookiecutter.frontend_pipeline in ['Gulp', 'Webpack'] %}
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user