Bad Request (400) after making supervisor restart

  • Posted April 8, 2014

After restarting my django app: supervisorctl restart [process] I’ve got Bad Request(400) error when visiting my site. The app is under nginx with gunicorn and supervisor.

I remember to had the same problem some time ago and restarting supervisor from some specific folder on the server had helped. I’ve tried to restart supervisor from different locations, however it doesn’t help.


Have you changed settings.DEBUG before restart? When you change DEBUG setting to False, you must also set ALLOWED_HOSTS. You may simply make Django accept requests by allowing localhost:


This will work if gunicorn is running on same machine and it is bound to

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

I’m having the same problem. With… DEBUG = True ALLOWED_HOSTS = [‘’]

…the page displays. If I set DEBUG to False, I get the Bad Request(400) error.

It would be great if this could be clarified in the tutorial.

Could you provide some more information to help us figure out what might be happening here? Is there anything logged in /var/log/nginx/error.log <br> <br>If you launch it manually, is there any gunicorn error output to the command line? <br> <br>Thanks!