sqlalchemy 是非异步库

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).

猜你喜欢

转载自blog.csdn.net/weixin_33688840/article/details/90883312
今日推荐