I have hosted Djano app on Nginx-waitress architecture.Both are running on different ports on same server.There is an AWS ELB which directs requests to Nginx port.
I have a functionality which query database based on user input and produces multiple csv files.These files are then zipped and sent to user for download.
user gets 504 error after 2-3 minutes even when the file is being generated /has been generated in server .It takes around 4-5 minutes (for the whole process)to generate 500 Mb zipped file.And the file size is normally greater than 100 Mb in most of the cases.
I tried diferent perumation and combination of below setting in nginx and waitress but i am not getting any difference.
nginx.conf
http {
include mime.types;
default_type application/octet-stream;
include C:/nginx-1.23.3/sites-enabled/senginx.conf;
charset utf-8;
sendfile on;
client_max_body_size 500m;
send_timeout 15m;
}
senginx.conf
server {
listen 6003;
server_name rnd.aicofindia.com;
location /static/ {
alias C:/Users/Administrator/Desktop/Project/sarus-master/static/;
}
location /media/ {
alias C:/Users/Administrator/Desktop/Project/sarus-master/media/;
}
location / {
proxy_read_timeout 15m;
proxy_connect_timeout 15m;
proxy_send_timeout 15m;
keepalive_timeout 15m;
keepalive_time 1h;
proxy_socket_keepalive on;
proxy_pass http://localhost:9090;
}
}
waitress.conf
from waitress import serve
from sarus_project.wsgi import application
if __name__ == '__main__':
serve(application, host = 'localhost', port='9090',channel_timeout=900,cleanup_interval=900)