Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 无法为金字塔应用程序提供服务_Python_Pyramid_Gunicorn - Fatal编程技术网

Python 无法为金字塔应用程序提供服务

Python 无法为金字塔应用程序提供服务,python,pyramid,gunicorn,Python,Pyramid,Gunicorn,我对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 la

我对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)
我猜gunicorn中的main是指金字塔init中的main方法,但该方法将(global_config,**settings)作为args,因此我认为gunicorn可能在某种程度上看错了方法。以前有人见过类似的东西吗

谢谢


C

调用
pyzendoc:main
期望找到一个接受
(环境,启动响应)
签名的可调用函数,作为WSGI应用程序,在
main(全局配置,**设置)
返回一个签名之前,您不会拥有该签名。一个更好的选择是使用
gunicorn\u-paster
,如图所示。

嗨,Michael。谢谢你的回复。我已经尝试过gunicorn_粘贴程序,现在既可以使用上面相同的选项直接调用,也可以在.ini文件中将服务器指定为gunicorn,就像在链接中一样。gunicorn日志和netstat现在都显示gunicorn正在监听127.0.0.1:8000,但是如果我执行本地curl,则什么都没有注册。那么它是否与pserve一起工作?我是说服务员当服务员,就像金字塔教程一样。嗨,迈克尔。你的第一个答案是正确的。我有一些其他的配置问题。谢谢你的帮助。