简体   繁体   English

在Nginx后面调试Django / Gunicorn

[英]Debugging Django/Gunicorn behind Nginx

Fresh install of Nginx, Gunicorn, Supervisor, New Relic, Django, Postgres, etc. Hitting the URL gives a big fat "Internal Server Error." 全新安装Nginx,Gunicorn,Supervisor,New Relic,Django,Postgres等。点击URL会产生很大的“内部服务器错误”。

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.) 在Nginx配置中启用调试会提供大量细节,但没有任何内容指出导致500错误的原因(只是它正在发生)。

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. 接下来,我通过supervisorctl关闭了Gunicorn并通过python manage.py runserver启动了应用程序,点击了URL,一切运行正常。

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: 退一步,关闭runserver并使用bin/gunicorn_django gunicorn_django手动启动bin/gunicorn_django ,这是我能够访问的最接近可用的跟踪日志:

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. ROOT_URLCONF问题是通用的,可能是由许多事情引起的。 My question is what are some next steps I can use to continue tracking down what is going on? 我的问题是,我可以使用哪些后续步骤继续追踪正在发生的事情?

Thanks 谢谢

The mention of Settings not settings (notice the capital) is suspicious. 提及Settings而不是settings (注意资本)是可疑的。 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. 我个人注意到使用Aptana Studio, from django.conf import输入后出现的一个自动完成选项是Settings ,但这显然不是你真正想要的。 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. 我会在您的项目中搜索Settings (当然是区分大小写),并根据需要将其更改为小写。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM