Django REST API 504 Gateway Time-out Error

so I have this API that takes a post request and needs almost 3 minutes to process and return some results in response.

I've tried all the ways mentioned in this link including configuring Nginx and gunicorn:

Gunicorn:

GUNICORN_TIMEOUT=300

Nginx:

server {
listen 80;
client_max_body_size 250M;
server_tokens off;

location / {
    include /etc/nginx/proxy_params;
    proxy_pass      http://0.0.0.0:3000;
    proxy_connect_timeout   900;
    proxy_send_timeout      900;
    proxy_read_timeout      900;
    send_timeout            900;
}

location /static/ {
   alias /app/static/;
}

location /media/ {
   alias /app/media/;
}

}

but it only increased the timeout to 90s and after that raise an error again.

Back to Top