python – 无法使用gunicorn运行龙卷风应用程序

python – 无法使用gunicorn运行龙卷风应用程序,第1张

概述我无法使用gunicorn运行龙卷风应用程序.启动应用程序时出错.我想用gunicorn运行它,因为我需要一些很好的功能,如:graceful-timeout,response-timeout等… 龙卷风app: $cat wsgi.py 源代码: import tornado.webimport tornado.wsgifrom api.handler import MainHandler, 我无法使用gunicorn运行龙卷风应用程序.启动应用程序时出错.我想用gunicorn运行它,因为我需要一些很好的功能,如:graceful-timeout,response-timeout等…

龙卷风app:

$cat wsgi.py

源代码:

import tornado.webimport tornado.wsgifrom API.handler import MainHandler,APIV2Handler,InvalIDRequestHandlerdef app(*args):    app = tornado.web.Application([        (r"/",MainHandler),(r"(/v3/(\w+)/(\w+)/)",APIV2Handler),(r"(/v3/(\w+)/(\w+))",InvalIDRequestHandler)    ])    return tornado.wsgi.WsgiContainer(tornado.wsgi.WsgiAdapter(app))

庆典:

$gunicorn wsgi:app --bind 127.0.0.1:9080

追溯:

[2015-07-06 14:41:16 +0000] [21806] [INFO] Starting gunicorn 19.3.0[2015-07-06 14:41:16 +0000] [21806] [INFO] Listening at: http://127.0.0.1:9080 (21806)[2015-07-06 14:41:16 +0000] [21806] [INFO] Using worker: sync[2015-07-06 14:41:16 +0000] [21811] [INFO] Booting worker with pID: 21811[2015-07-06 14:41:21 +0000] [21811] [ERROR] Error handling requestTraceback (most recent call last):  file "venv/lib/python2.7/site-packages/gunicorn/workers/sync.py",line 130,in handle    self.handle_request(Listener,req,clIEnt,addr)  file "venv/lib/python2.7/site-packages/gunicorn/workers/sync.py",line 176,in handle_request    for item in respiter:TypeError: 'WsgiContainer' object is not iterable^C[2015-07-06 14:41:23 +0000] [21806] [INFO] Handling signal: int[2015-07-06 14:41:23 +0000] [21811] [INFO] Worker exiting (pID: 21811)[2015-07-06 14:41:23 +0000] [21806] [INFO] Shutting down: Master

有任何想法吗?

Ben Darnell的更新:

我试过这个:

import tornado.webimport tornado.wsgifrom API.handler import MainHandler,InvalIDRequestHandler)    ])    return tornado.wsgi.WsgiAdapter(app)

但结果是一样的:

TypeError: 'WsgiAdapter' object is not iterable
解决方法 适合我:

gunicorn -k tornado wsgi:app

wsgi.py

import tornado.webimport tornado.wsgifrom API.handler import MainHandler,InvalIDRequestHandlerapp = tornado.web.Application([    (r"/",InvalIDRequestHandler)])

祝好运!

总结

以上是内存溢出为你收集整理的python – 无法使用gunicorn运行龙卷风应用程序全部内容,希望文章能够帮你解决python – 无法使用gunicorn运行龙卷风应用程序所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1197381.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-03
下一篇 2022-06-03

发表评论

登录后才能评论

评论列表(0条)

保存