Example Django apps showcasing how to use django-vite v3.
All of the example demos run on Docker. Build the images with:
make build
This demo demonstrates backwards compatibility with legacy DJANGO_VITE_*
settings from django-vite v2 and earlier versions.
make legacy-settings-demo
This demo shows how to run a single django-vite app using the new DJANGO_VITE={...}
settings from django-vite v3 and higher. Everything else in the setup is identical to the legacy-settings demo.
make new-settings-demo
This demo shows django-vite loading assets from 4 different vite apps.
make build-multi-app-demo
make multi-app-demo
This demo loads assets from 4 different vite apps:
dev_mode=True
.dev_mode=True
.STATIC_ROOT
with dev_mode=False
.STATIC_ROOT
with dev_mode=False
.Noteworthy differences between the multi-app setup and the other demos:
DJANGO_VITE
settings that enable multiple apps.static_url_prefix
for directing build output and dev server routing.There's 1 bug I've found with this demo: I'm not able to make HMR work on 2 different vite dev servers if they're both trying to update assets on the same page. Only one vite app will get changes registered to it in real time.
Realistically, a developer is unlikely to be working on more than 1 vite app with dev_mode=True on the same page. But it may still be worth investigating.