Bad Request (400) after making supervisor restart

April 8, 2014 2.1k views
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.
1 comment
  • 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:

    ALLOWED_HOSTS = ['']

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

2 Answers
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

If you launch it manually, is there any gunicorn error output to the command line?


I'm having the same problem.
DEBUG = True

...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.

Have another answer? Share your knowledge.