我正在尝试在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
当我尝试使用以下命令行从/var/www/uwsgi/webapp
运行gunicorn
时:
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'
我理解的是,在settings.py文件中没有ROOT_URLCONF,因为中间件应该在多个具有单独urlconfs的应用之间进行路由。但是看起来gunicorn对此并不满意。我该怎么办?