0

I run Nginx server for Flask and I want the server to run py script. It takes about 5 minutes to execute (intentional) and on the dev server, everything works ok. When I deploy to the production, when executing, after 60 seconds I get 504 error.

I tried the below:

uwsgi.ini

http-timeout = 3600000
harakiri = 600 
http-timeout = 600 
socket-timeout = 600 
worker-reload-mercy = 600 
reload-mercy = 600 
mule-reload-mercy = 600

nginx.conf :

proxy_connect_timeout       600;
proxy_send_timeout          600;
proxy_read_timeout          600;
send_timeout                600;

I searched against similar topics, however most of them refer to a situation where i.e. upload time is longer than 60 sec. This time, I'm facing a problem with the internal process running longer than 60 seconds. Does anyone have any thoughts?

InKubus
  • 11
  • 4

1 Answers1

0

Are you using a server for your framework underneath? Like Gunicorn or something? I would recommend using Gunicorn, as Flasks inbuilt server - to my knowledge, is not as easily configureable.

In your Gunicorn settings all you have to do is just set timeout=120 (120 seconds) or whatever number of seconds you want. If you're going to run your app in production I highly recommend Gunicorn.

Avian
  • 126
  • 1
  • 9