Re:Show HN: Django and React SaaS boilerplate tutorial
by bredren on Wednesday December 23, 2020 @11:38AM
(#25519377)
That's a nice idea for new projects but how would you handle a company with large existing Django sites that want to bring in one or two react-based SPAs?
[ Parent
| on HN ]
Re:Show HN: Django and React SaaS boilerplate tutorial
by nickserv on Wednesday December 23, 2020 @01:29PM
(#25520502)
We did this with Vue.js, not sure if it applies to React (I haven't used React).
The way we did it was to start with a few parts of the page that really benefited from having Vue.js, using a simple `script src=`. So no components or anything fancy. For this we just put the JS stuff using Django's template system.
Once we had proved that this improved the site, we went all in and started to use the "proper" way, building the JS and deploying to a CDN.
In parallel to this we set up Django Rest Framework and set up alternate routes to fetch the view data as JSON.
In retrospect I would probably skip the hybrid system and just start building view components, but it was done this way so we could more easily revert if it didn't work out.