afk
afk

Reputation: 558

Gunicorn not loading react frontend in django react nginx configuration digitalocean

i am trying to deploy django react app on digitalocean with nginx gunicorn. i have created the virtualenv and when i trying to run:

gunicorn --bind 0.0.0.0:8000 myproject.wsgi

its doesn't load the react front but django backend loading. i am aware of that gunicorn does not static but it loading white page with error:

You need to enable JavaScript to run this app.

enter image description here

Upvotes: 0

Views: 968

Answers (1)

aman kumar
aman kumar

Reputation: 3156

since react needs the js library file to server, and it not rendered due to that it might be giving the error. server all the static file through nginx

server {
    listen 80;
    server_name example.com;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/django/sample;
    }

    location / {
        include         uwsgi_params;
        uwsgi_pass      unix:/home/django/sample/sample.sock;
    }
}

Upvotes: 1

Related Questions