Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React and Django deployment

I developed an app and I want to deploy it on a server. For backend I use Django and for frontend React. The communication between React and Django is via rest api. I also have an Arduino which communicates with Django via rest. I use nginx on server. What is the best way how to deploy this app? Thanks a lot

like image 776
Vortex Avatar asked Sep 19 '26 17:09

Vortex


1 Answers

you can use 1 server with nginx and gunicorn and make the axios to point to localhost for the react app, create 1 gunicorn for the django and 2 nginx 1 for the django and the other for the react,

Gunicorn use the socket and service file you can use the below link (it will help you for the deployment of django): https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04

for the react app it is easier, you can make the build on your local and clone the project on the server (make the app to point to localhost)

just create nginx file with the belw:

server {
   server_name yourdomain.com;
   root /project-path/;
   index index.html index.htm;
   location / {
   try_files $uri /index.html =404;
  }
} 
like image 102
Mokhtar Shawky Avatar answered Sep 22 '26 09:09

Mokhtar Shawky



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!