简体   繁体   中英

Django share requests.session() between views

I make 2-3 calls to an API URL per view and using requests.session() cuts down the connection time by a significant amount. Is there a way to keep the session open between views to avoid the initial setup time?

I'm looking for something like persistent database connections but for sessions.

我不知道什么可以帮助您实现数据库中的会话持久性,但是您可以尝试通过更改Django会话引擎来优化时间。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM