Flask Nginx uWSGI 504 Gateway Timeout Error Flask Nginx uWSGI 504 Gateway Timeout Error flask flask

Flask Nginx uWSGI 504 Gateway Timeout Error


Sometimes when deploying a flask app with library like Keras and others they have some issue with threading in uWSGI.

You can change a few things in myproject.ini to make it work:

  1. add these setting in myproject.ini
master = false <-------- thisprocesses = 1 <--------- and this
  1. add cheaper = 0 to your myproject.ini
  2. add lazy-apps = true to your myproject.ini

So now your myproject.ini file may look like:

[uwsgi]module = wsgi:appmaster = false <-------- thisprocesses = 1 <--------- and thissocket = myproject.sockchmod-socket = 660vacuum = truedie-on-term = truecheaper = 0 <----------- also this, if option 1 is not enough or doesn't worklazy-apps = true <------ in some case, this might help