mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-09 14:34:53 +03:00
Fix email links when using Docker with Gulp
This commit is contained in:
parent
52eebeea1d
commit
7e96773d6e
|
@ -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
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -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 %}
|
||||
}
|
||||
|
|
|
@ -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 %}
|
||||
|
|
Loading…
Reference in New Issue
Block a user