Open effa opened 7 years ago
Btw, I have found that webpack offers a flexible proxy settings, which could be probably used to avoid the above mentioned hack with serving some static assets by django-dev-server and some by webpack-dev-server (see the examples in their docs).
It would be extremely useful for quick understanding of how it works, because it gets complicated. Some quick notes:
There are 3 different settings/modes/environments:
Local development
./manage.py webserver
frontend/static/
(collected and built by webpack according towebpack.dev.config.js
)flocsweb/templates/index.html
(useswebpack_loader
to point to correct JS bundle)The fact, that 3rd parties' static assets are server by django-dev-server was just a hack to make it work, because we weren't able to change the port for these 3rd party assets (but there is probably no problem with this approach - hot reloading is only needed for our JS modules).
Local testing
./manage.py runserver
frontend/static/
(collected and built by webpack according towebpack.config.js
)flocsweb/templates/index.html
(useswebpack_loader
to point to correct JS bundle)Staging and production
git push staging|production
../static/
(collected and built by webpack according towebpack.config.js
and then copied by Django`s collectstatic)flocsweb/templates/index.html
(useswebpack_loader
to point to correct JS bundle)