且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Django总是重定向到登录页面[在Chrome和Firefox中,不会发生在Safari中]

更新时间:2022-04-29 03:22:59

我做了两件事,现在似乎消失了。

I did two things, and the issue seems to disappear for now.


  1. 更新我的chrome / firefox

  2. 将其添加到settings.py

  1. Update my chrome/firefox
  2. Add this into the settings.py

SESSION_COOKIE_AGE = 1209600#2周内过期

SESSION_COOKIE_AGE = 1209600 #expire in 2 weeks

然而,第二个是自动由Django从文档配置。可能我的一些使用Cookie的javascripts会影响到期时间

However, the 2nd one is automatically configured by Django from the docs. Probably some of my javascripts playing with cookies affect the expiration time