sqlalchemy non-asynchronous library

The "scope" in scoped_session is a thread, which makes it inappropriate for use in an asynchronous framework like Tornado. It's been a long time since I've used sqlalchemy sessions, but I think what you want to do is put a sessionmaker on the Application, and make a session from it in RequestHandler.prepare (not initialize - they're almost equivalent, but if something goes wrong you generally get nicer error pages from prepare).

Guess you like

Origin blog.csdn.net/weixin_33688840/article/details/90883312