Django Uwsgi Nginx 504 Gateway Timeout

Oct 21, 2014 · Updated: Jul 12, 2021 · by Tim Kamanin

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; }

Hey, if you've found this useful, please share the post to help other folks find it:

There's even more:

Subscribe for updates

  • via Twitter: @timonweb
  • old school RSS:
  • or evergreen email ↓ ↓ ↓