Does initialize in tornado.web.RequestHandler get

2020-06-28 04:06发布

问题:

There'a an initialize method in tornado.web.RequestHandler class, is it called every time there's a request?

回答1:

Yes, tornado calls initialize for each request.

If you want to share state between requests(like db connection) - store it in self.application.