【发布时间】:2020-04-18 15:01:09
【问题描述】:
我不知道这个错误是什么:in __init__ self.initialize(**kwargs) # 类型:忽略 类型错误:initialize() 缺少 1 个必需的位置参数:'url'
我使用 python 作为后端。我这里是新人。在这段代码中,我使用的是 tornado web。是的,这段代码正在调试,但是当我在浏览器上打开 localhost:8882/ 和 localhost:8882/animals 时,它会显示这个错误。请帮帮我
我的 index.py 页面代码:-
import tornado.web
import tornado.ioloop
class basicRequestHandler(tornado.web.RedirectHandler):
def get(self):
self.write('Hello, World this is python Command from backend')
class listRequestHandler(tornado.web.RedirectHandler):
def get(self):
self.request.render('index.html')
if __name__ == "__main__":
app = tornado.web.Application([
(r"/",basicRequestHandler),
(r"/animals", listRequestHandler),
])
port = 8882
app.listen(port)
print(f"Application is ready and listening on port {port}")
tornado.ioloop.IOLoop.current().start()
我的 index.html 页面是:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>List of Animals</title>
</head>
<body>
<h1>This is the list of Animals</h1>
<select>
<option>Cat</option>
<option>Horse</option>
<option>Rat</option>
<option>Cow</option>
</select>
</body>
</html>
【问题讨论】:
-
跟踪的完整错误是什么?