I got error 500 from gunicorn whet i set Debug=False in django settings py - Upstart variant

1.2k views Asked by At

The problem is identical to this one but I use upstart. How to modify my upstart conf below to make it work. gunicorn.conf

description "gunicorn"

start on (filesystem)
stop on runlevel [016]

respawn
console log
setuid nobody
setgid nogroup
chdir /home/spadmin/spcrm

exec /home/spadmin/.virtualenvs/crm/bin/python /home/spadmin/spcrm/manage.py run_gunicorn -w 3 -k gevent

Nginx is started via upstart conf from nginx package. I can post it if it's relevant.

And from curiosity: is this problem related to timing when starting jobs? The above question provides solution but not explanation.

1

There are 1 answers

0
Joel Crocker On

Jingo's comment describes the solution to a common problem when running with DEBUG = False. Try that, but also make sure you're checking your gunicorn logs/console. The actual exception should be logged there, and that would let you know whether it's the ALLOWED_HOSTS problem (you would see a SuspiciousOperation exception), or some other issue.

You may also want to consider adding Sentry to your project (via its Raven client). This will collect log messages and log uncaught exceptions to a very useful web app. See http://sentry.readthedocs.org/en/latest/