Django-Gunicorn-Nginx Why do I get an Internal server error every time I restart Gunicorn?

Posted September 22, 2014 8k views

I set up a droplet on digital ocean using the one-click installer. I host my code on a git repo. and I use git pull to merge changes, followed by service gunicorn reload to restart gunicorn. The problem is that everytime I do this and try to visit my site I get an ‘internal server error’ messages, and after I refresh once or twice the actual page loads.

It is strange because I get the message even if I wait for a while (15 minutes) before visiting the web page, so I’m not sure if I get this because gunicorn was still restarting or for some other reason. Any hints on what might be going on ?

P.S. I asked the same question on StackOverflow but got no hits

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

This is quite an old question but for anyone else who may be experiencing this problem, the first thing I would suggest anytime you are receiving an error from your web server is to check the web server’s logs. In this case, reviewing the logs in /var/log/nginx/error.log would likely lead to the underlying cause of the internal server error.