mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-02-16 19:41:03 +03:00
Fix BrowserSync config on non-Docker setup (#3461)
This commit is contained in:
parent
05d383fbda
commit
79bd3e7f14
|
@ -133,31 +133,31 @@ function runServer(cb) {
|
||||||
|
|
||||||
// Browser sync server for live reload
|
// Browser sync server for live reload
|
||||||
function initBrowserSync() {
|
function initBrowserSync() {
|
||||||
browserSync.init(
|
browserSync.init(
|
||||||
[
|
[
|
||||||
`${paths.css}/*.css`,
|
`${paths.css}/*.css`,
|
||||||
`${paths.js}/*.js`,
|
`${paths.js}/*.js`,
|
||||||
`${paths.templates}/*.html`
|
`${paths.templates}/*.html`
|
||||||
], {
|
], {
|
||||||
// https://www.browsersync.io/docs/options/#option-proxy
|
// https://www.browsersync.io/docs/options/#option-proxy
|
||||||
|
proxy: {
|
||||||
{%- if cookiecutter.use_docker == 'n' %}
|
{%- if cookiecutter.use_docker == 'n' %}
|
||||||
proxy: 'localhost:8000'
|
proxy: '127.0.0.1:8000',
|
||||||
{%- else %}
|
{%- else %}
|
||||||
proxy: {
|
|
||||||
target: 'django:8000',
|
|
||||||
proxyReq: [
|
|
||||||
function(proxyReq, req) {
|
|
||||||
// Assign proxy "host" header same as current request at Browsersync server
|
|
||||||
proxyReq.setHeader('Host', req.headers.host)
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
// https://www.browsersync.io/docs/options/#option-open
|
// https://www.browsersync.io/docs/options/#option-open
|
||||||
// Disable as it doesn't work from inside a container
|
// Disable as it doesn't work from inside a container
|
||||||
open: false
|
open: false,
|
||||||
|
target: 'django:8000',
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
proxyReq: [
|
||||||
|
function(proxyReq, req) {
|
||||||
|
// Assign proxy "host" header same as current request at Browsersync server
|
||||||
|
proxyReq.setHeader('Host', req.headers.host)
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Watch
|
// Watch
|
||||||
|
|
Loading…
Reference in New Issue
Block a user