nickjj / docker-django-example

A production ready example Django app that's using Docker and Docker Compose.
MIT License
1.17k stars 249 forks source link

adding separate frontend spa (react/vue/etc) #13

Closed vic-cieslak closed 2 years ago

vic-cieslak commented 2 years ago

Hi, Would using django as api and adding new container for spa be possible/easy with this setup?

nickjj commented 2 years ago

You could use DRF if you wanted to, nothing would need to change container wise. The front-end stuff is already in their own containers using esbuild and tailwind. Using React or whatever you want to use would be a matter of installing React and using it.

vic-cieslak commented 2 years ago

But to run in SPA mode with something like yarn dev or npm start I need to make some specific changes, right? Otherwise it will be SSR with django.

(I have in mind vuejs/quasar.dev)

nickjj commented 2 years ago

What is SPA mode? Would React or whatever tool you use require running its own dedicated tool instead of just esbuild? Normally esbuild would watch your JS for changes and reload things for you.

vic-cieslak commented 2 years ago

yep I had some misconception about that sorry man! I will integrate quasar/vue soon and see how it works for me.

nickjj commented 2 years ago

It's all good, let us know how it goes.

If you end up having to make a number of changes feel free to open a https://github.com/nickjj/docker-django-example/discussions outlining the steps you took, that would be very helpful for others and much appreciated.