3

我正在尝试在 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_URLCONFinsettings.py因为中间件应该在具有单独 urlconfs 的多个应用程序之间路由。但它看起来gunicorn对此并不满意。我应该怎么办?

4

1 回答 1

0

好的,我明白了,这个应用程序有两个不同的设置副本,一个在settings.py(未使用),另一个在./app/settings/*.py(真实)。搜索来源ROOT_URLCONF揭示了真实设置隐藏的地方。

于 2013-09-19T14:33:00.333 回答