nginx+ uwsgi gives 502 Bad Gateway-Collection of common programming errors

I used this guide to set it up and it was working to server my django app for a while, but after adding a new django module, without touching any of the nginx or uwsgi configs, now the server leads to 502 502 Bad Gateway error. The nginx error.log says:

*1 upstream prematurely closed connection while reading response header from upstream, client: x.x.x.x, server: blabla.com, request: “GET / HTTP/1.1”, upstream: “uwsgi://127.0.0.1:4000”, host: “x.x.x.x”

I appreciate your hints to resolve this.

  1. This error usually indicates that your Django application has crashed (raised an unhandled exception). You should be able to get more information from the uwsgi logs at /var/log/uwsgi.