Debugging Django/Gunicorn behind Nginx
Question: Fresh install of Nginx, Gunicorn, Supervisor, New Relic, Django, Postgres,
etc. Hitting the URL gives a big fat "Internal Server Error."

Turning debug on in the Nginx configuration gives a whole lot of detail, but
nothing that points to what is causing the 500 error (just that it is
happening.)

Next, I shut down Gunicorn via supervisorctl and started the application up
via `python manage.py runserver`, hit the URL, and everything is running fine.

Step back, shut off `runserver` and started Gunicorn manually using
`bin/gunicorn_django` and this is the closest to a usable trace log that I've
been able to get to:

    
    
    2012-09-05 21:39:25 [5927] [ERROR] Error handling request
    Traceback (most recent call last):
      File "/somewhere/local/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 102, in handle_request
        respiter = self.wsgi(environ, resp.start_response)
      File "/somewhere/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 241, in __call__
        response = self.get_response(request)
      File "/somewhere/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 82, in get_response
        urlconf = settings.ROOT_URLCONF
      File "/somewhere/local/lib/python2.7/site-packages/django/utils/functional.py", line 185, in inner
        return func(self._wrapped, *args)
    AttributeError: 'Settings' object has no attribute 'ROOT_URLCONF'
    

I'm not asking for an answer to what is going on here, because I know this is
not enough detail to figure out much. The `ROOT_URLCONF` issue is generic and
could be caused by a lot of things. My question is what are some next steps I
can use to continue tracking down what is going on?

Thanks


Answer: The mention of `Settings` not `settings` (notice the capital) is suspicious.
I've noticed personally from using Aptana Studio, that one of the autocomplete
choices that appears after typing `from django.conf import` is `Settings`, but
that's obviously not what you really want. Perhaps something similar happened
and you accepted the incorrect autocomplete choice? I'd search your project
for `Settings` (with case-sensitivity on, of course), and change it to
lowercase as appropriate.

