我是龙卷风的新手。我从这样的“Hello World”代码开始学习:
import tornado.ioloop
import tornado.web
import tornado.httpserver
class HelloHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world!")
application = tornado.web.Application([
(r"/", HelloHandler)
])
http_server = tornado.httpserver.HTTPServer(application)
if __name__ == "__main__":
http_server.listen(80)
# http_server.listen(443)
tornado.ioloop.IOLoop.instance().start()
当我在浏览器中输入“http://localhost”时,它可以工作并打印
"Hello, world!"
但是如果我尝试了请求“https://localhost”,它会返回:
Error 102 (net::ERR_CONNECTION_REFUSED): The server refused the connection.
网上关于Tornado的文档太少了,谁能告诉我如何处理Https协议请求?