Django Uwsgi Nginx 504 Gateway Timeout

21 Oct · by Tim Kamanin · 1 min read

I had a long running process (data import) and encountered 504 Gateway Timeout error.

I use Nginx / uwsgi pair to serve my Django app. After doing some research it turned out that the problem is in uwsgi_read_timeout_directive.

Directive sets the amount of time for upstream to wait for a uwsgi process to send response data. By default the value is 60 seconds. Set it to bigger value if you have a long running process.

You can do that in your nginx config: location / { uwsgi_read_timeout 500; }

Comments

Required for comment verification



Lukas

Awesome. It worked for me :)

Reply · 1 year, 1 month ago
Ludwig

Thanks, great simple post. Caught this error when generating a huge PDF with reportlab, takes up to 10 minutes.

Reply · 2 years, 3 months ago
ideavate

I want to thank you for this informative read, I really appreciate sharing this great post. Keep up your work. Thanks for this very useful info you have provided us.

Reply · 3 years, 1 month ago