How Can i use Nuxt and Django for production at the same time?

Viewed 632

I have a background in Django and a some experience in Vue. I have used Vue for almost a year now, but since I need an SSR I have to use Nuxt.However, I am still very confused with how to deploy it in the server along with Django. Should I deploy them in the same server or should I deploy them in a different server with Django server for API and Nuxt for the front end?

1 Answers

I have also used Vue alongside Django for a while in my project and I'm looking into Nuxt right now.

I'm planning to migrate my standard Vue codebase into a Nuxt project.

The thing that I'm looking to do is to deploy Nuxt as a server target: 'server' (which is the default) alongside Django in Docker containers.

The idea is to be able to start the application with a simple docker-compose up.

I'm not done yet but you could look at it.

Typically, your docker-compose file would have 3 service :

  • The Django backend (API)
  • The Nuxt frontend (which make calls to the backend API)
  • Nginx which would route the traffic to Django or Nuxt according to your needs

EDIT BELOW :

Meanwhile, I changed my mind and instead of having Nuxt running as a server, I only have 2 containers :

  • The Django backend (API)
  • Nginx which serves my built Vue frontend and routes the traffic accordingly
Related