【发布时间】:2019-12-17 23:49:54
【问题描述】:
我正在尝试使用 wsgi 形式的龙卷风,因为服务器只接受 wsgi。
我已经为 tornado + wsgi 尝试了所有服务器变体,总是收到这个错误:__call__() takes 2 positional arguments but 3 were given
# app/__init__.py
import tornado.wsgi
import tornado.web
import wsgiref.simple_server
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.render("templates/index.html")
def routes():
return [
(r"/", MainHandler),
]
class Application(tornado.wsgi.WSGIContainer):
def __init__(self):
handlers = routes()
tornado.wsgi.WSGIContainer.__init__(self, handlers)
# wsgi.py
import wsgiref.simple_server
from app import Application
application = Application()
server = wsgiref.simple_server.make_server('', 8888, Application())
server.serve_forever()
这是错误跟踪:
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/wsgiref/handlers.py", line 137, in run
self.result = application(self.environ, self.start_response)
TypeError: __call__() takes 2 positional arguments but 3 were given
127.0.0.1 - - [10/Aug/2019 17:40:58] "GET / HTTP/1.1" 500 59
我希望可以使用 tornado.wsgi,任何帮助都会很有用!
【问题讨论】:
标签: tornado wsgi python-3.7