我正在尝试在Gunicorn下运行现有的uWSGI连接的Django应用程序(实际上是一组应用程序)。 uWSGI配置是:
[uwsgi]
plugins = python27
home = /var/www/uwsgi/webapp/app/venv
chdir = /var/www/uwsgi/webapp
chdir2 = /var/www/uwsgi/webapp/app
module = uwsgi_app
processes = 150
master = true
socket = 127.0.0.1:3031
socket-timeout = 300
env = DJANGO_SETTINGS_MODULE=settings
当我尝试使用此命令行从gunicorn
运行/var/www/uwsgi/webapp
时:
gunicorn_django --bind 127.0.0.1:9031 --access-logfile /tmp/gunicorn.log --error-logfile /tmp/gunicorn.err --workers=40
它启动但我在错误日志中得到以下内容:
2013-09-19 08:17:16 [2981] [ERROR] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/sync.py", line 131, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 272, in __call__
response = self.get_response(request)
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 82, in get_response
urlconf = settings.ROOT_URLCONF
File "/usr/lib/python2.7/dist-packages/django/utils/functional.py", line 277, in __getattr__
return getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'ROOT_URLCONF'
我的理解是ROOT_URLCONF
中没有settings.py
,因为中间件应该在具有单独urlconf的多个应用之间路由。但看起来gunicorn
对此并不满意。我该怎么办?
答案 0 :(得分:0)
好吧,我知道了,这个应用程序有两个不同的设置副本,一个在settings.py
(未使用),另一个在./app/settings/*.py
(真实)。搜索ROOT_URLCONF
的来源会显示真实设置隐藏的位置。