【发布时间】:2012-08-30 19:56:57
【问题描述】:
全新安装 Nginx、Gunicorn、Supervisor、New Relic、Django、Postgres 等。点击 URL 会导致“内部服务器错误”。
在 Nginx 配置中打开调试提供了很多详细信息,但没有任何内容指出导致 500 错误的原因(只是它正在发生。)
接下来,我通过 supervisorctl 关闭 Gunicorn,并通过 python manage.py runserver 启动应用程序,点击 URL,一切正常。
后退一步,关闭 runserver 并使用 bin/gunicorn_django 手动启动 Gunicorn,这是我能找到的最接近可用跟踪日志的:
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'
我不是要回答这里发生的事情,因为我知道这还不够详细,无法弄清楚。 ROOT_URLCONF 问题是通用的,可能是由很多事情引起的。我的问题是我可以使用哪些后续步骤来继续追踪正在发生的事情?
谢谢
【问题讨论】:
-
问题恰好是gunicorn实际上无法找到设置文件。在我的主管配置中指定设置所在的目录后,它开始工作。很高兴我弄清楚了,但仍然对为什么有必要感到困惑。相同的应用程序可以在其他 2 台服务器上正常运行,无需此规范。
标签: django debugging nginx gunicorn