Search code examples
pythontornado

Does initialize in tornado.web.RequestHandler get called every time for a request/


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


Solution

  • Yes, tornado calls initialize for each request.

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