无法提供金字塔应用程序

时间:2013-10-30 14:26:36

标签: python pyramid gunicorn

我对枪械很缺乏经验。我已将其安装在虚拟环境中,并尝试使用以下内容为金字塔应用程序提供服务:

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)

我猜测枪炮中的主要是指金字塔 init 中的主要方法,但该方法采用(global_config,**设置)作为args所以我认为也许gunicorn会以某种方式看待错误的方法。以前有人见过类似的东西吗?

由于

C

1 个答案:

答案 0 :(得分:2)

调用pyzendoc:main期望找到一个接受(environ, start_response)签名的可调用对象,作为一个WSGI应用程序,在main(global_conf, **settings)返回一个之前你不会有。更好的选择是使用gunicorn_paster,如图here所示。