0

我对独角兽非常缺乏经验。我将它安装在虚拟环境中,并尝试使用以下内容为金字塔应用程序提供服务:

env/bin/gunicorn --pid /home/staging/gunicorn.pid --bind 0.0.0.0:8000 pyzendoc:main

但是,每次发送请求时,我都会从 gunicorn 获得以下跟踪

2013-10-30 14:16:20 [1284] [ERROR] Error handling request
Traceback (most recent call last):
  File "/home/staging/api/env/local/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 126, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
TypeError: main() takes exactly 1 argument (2 given)

我猜 gunicorn 中的 main 是指金字塔init中的 main 方法,但该方法将 (global_config, **settings) 作为参数,所以我认为可能 gunicorn 以某种方式查看了错误的方法。有没有人见过类似的东西?

谢谢

C

4

1 回答 1

2

该调用pyzendoc:main期望找到一个接受签名的可调用对象,作为 WSGI 应用程序,直到返回一个(environ, start_response)您才拥有。main(global_conf, **settings)一个更好的选择是使用,如此gunicorn_paster所示。

于 2013-10-30T15:00:00.490 回答