How to expire Django session in 5minutes?

There are two parameters to expire sessions, SESSION_EXPIRE_AT_BROWSER_CLOSE and SESSION_COOKIE_AGE. If you want to expire in 5 minutes yours settings should like as: SESSION_EXPIRE_AT_BROWSER_CLOSE = False SESSION_COOKIE_AGE = 5 * 60 To combine both learn how do it writing your custom middleware “Is there a way to combine behavior of SESSION_EXPIRE_AT_BROWSER_CLOSE and SESSION_COOKIE_AGE”

Django, SESSION_COOKIE_DOMAIN with multiple domains

If you set your session cookie domain to start with a “.” character it will let you handle wildcard sub-domains and share a session cookie (login session) across multiple subdomains. In settings.py: SESSION_COOKIE_DOMAIN=”.stackoverflow.com” The above would allow a cookie to be shared across user1.stackoverflow.com and user2.stackoverflow.com. If you really do want the url’s to be … Read more