Gateway timeout 504 when moving from django development server to Nginx/uWSGI? -
i have django app talks remote raspberry pi acquire imagery through pi's camera. whenever test "get new image" button in app, browser gets hung 60 seconds , image never arrives.
the raspberry pi trying post image django app supposed save persistent storage.
the logs of nginx show 504 "gateway timeout" @ 60 second mark. however, worked smoothly when using django development server , took second post image. what's going wrong now?
make sure you're running uwsgi multiple processes , threads.
you can test on uwsgi command line adding:
--processes 4 --threads 2 or in uwsgi ini file:
processes = 4 threads = 2 if pi posting image app while waiting display result user, uwsgi needs able handle both things concurrently.
another possibility django app uses threads itself, , without --threads n or --enable-threads option uwsgi, gil isn't enabled when app runs. adding --enable-threads (or enable-threads = true ini file) enable gil without starting multiple app threads.
see a note on python threads in uwsgi docs if suspect app's threading may problem.
in case, make sure you've provided enough concurrency if you're seeing gateway timeouts.
Comments
Post a Comment