#What is the best way to deploy a REACT + DRF api in Ubuntu VPS?

3 messages · Page 1 of 1 (latest)

golden dragon
#

As far as I know. The idea is to publish the React frontend with some web server like NGINX or APACHE2.

Then for the DRF api project, the idea is to have it as an active service so that the react frontend can make requests to the backend (like http://localhost:8000/getProductById/).

Is it so?

If so, what is the best way to put the backend as an Ubuntu service, I have searched for guides, but most are for using normal Django, Django with templates. Can someone help me or give me some information.

At the moment I have already published the frontend on a server that I have created with NGINX and it is already accessible. Sorry if the question is very newbie 🙂

Thank you so much.

uneven blade
#

Yes perfect. I think we are using the same set up with REACT frontend and DRF backend on a AWS EC2 server, I think I use linus. The guy i use is https://www.youtube.com/c/LondonAppDeveloper. He has a Udemy course that uploads DRF to backend but I am not sure which one you are interested in or may be interested in

golden dragon
#

Thanks for the answer, but what I don't understand is: Do I have to expose a port or some IP to my django server or can I use a url like http://localhost:8000/getProductById/ in react to use the API? ? From what I saw, if my development django server (on a local windows machine) is running and I visit my published react feed app with a domain name, the local server is consumed by the frontend/react that is on the remote server. It is a good practice? The only thing that i have to do is create a django service in the VPS to keep always running? Thanks!