diff --git a/{{cookiecutter.project_slug}}/config/settings/local.py b/{{cookiecutter.project_slug}}/config/settings/local.py index 5a457df10..0c0588bd4 100644 --- a/{{cookiecutter.project_slug}}/config/settings/local.py +++ b/{{cookiecutter.project_slug}}/config/settings/local.py @@ -11,7 +11,7 @@ SECRET_KEY = env( default="!!!SET DJANGO_SECRET_KEY!!!", ) # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts -ALLOWED_HOSTS = ["localhost",{% if cookiecutter.js_task_runner == 'Gulp' and cookiecutter.use_docker == 'y' %} "django",{% endif %} "0.0.0.0", "127.0.0.1"] +ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1"] # CACHES # ------------------------------------------------------------------------------ diff --git a/{{cookiecutter.project_slug}}/gulpfile.js b/{{cookiecutter.project_slug}}/gulpfile.js index 3cac57414..a761a3d69 100644 --- a/{{cookiecutter.project_slug}}/gulpfile.js +++ b/{{cookiecutter.project_slug}}/gulpfile.js @@ -127,12 +127,21 @@ function initBrowserSync() { `${paths.js}/*.js`, `${paths.templates}/*.html` ], { + // https://www.browsersync.io/docs/options/#option-proxy {%- if cookiecutter.use_docker == 'n' %} - proxy: "localhost:8000" + proxy: 'localhost:8000' {% else %} - proxy: "django:8000", - // Browsersync may open the browser when ready, but it doesn't work from - // inside a container, so set this option to false + proxy: { + target: 'django:8000', + proxyReq: [ + function(proxyReq) { + // Set to the browsersync host & port to have email links working + proxyReq.setHeader('Host', 'localhost:3000') + } + ] + } + // https://www.browsersync.io/docs/options/#option-open + // Disable as it doesn't work from inside a container open: false {%- endif %} } diff --git a/{{cookiecutter.project_slug}}/local.yml b/{{cookiecutter.project_slug}}/local.yml index 05121560d..c6dd654e5 100644 --- a/{{cookiecutter.project_slug}}/local.yml +++ b/{{cookiecutter.project_slug}}/local.yml @@ -95,6 +95,7 @@ services: command: npm run dev ports: - "3000:3000" + # Expose browsersync UI: https://www.browsersync.io/docs/options/#option-ui - "3001:3001" {%- endif %}