by rojoca · 6y ago · 0 comments
This is probably partly due to the fact I find working with django rest framework serializers / views to be much nicer than django forms / views.
I think what puts most people off is the default requirement to go all-in and create an SPA with global state management and client-side managed routing, but this isn't actually necessary.
I have found incorporating Django with https://inertiajs.com to be a pretty solid alternative. I can write the whole frontend in React, and the backend in Django rest framework, but everything is still page based, so I don't require redux or any other kind of global state, just use the inertia utils to make page transitions.
NextJS is another alternative. To talk to a (django) API you need to go through getStaticProps and getServerSideProps which, depending on the location of your API server, can be a little slow, but you get pre-rendered HTML and page based routing so again no global state management required.
The problem with this approach is that you will need to manage another server process(nodejs) besides django for server-side rendering with nextjs.
There's also the benefit of being able to lean on Django patterns for sessions.
[1]: https://github.com/rojoca/django-rest-inertia [2]: https://github.com/zodman/inertia-django [3]: https://github.com/zodman/django-inertia-demo