settings.py
# The session set SESSION_COOKIE_NAME = " SessionID " # Key stored at the Session cookie on the browser, namely: sessionid = random string (default) SESSION_COOKIE_PATH = " / " # Save Session cookie path (default) SESSION_COOKIE_DOMAIN = None # Session saved cookie domain (default) SESSION_COOKIE_SECURE = False # whether Https transfer cookie (default) SESSION_COOKIE_HTTPONLY = True # whether the Session cookie only supports http transmission (default) SESSION_COOKIE_AGE = 1209600 # Session of cookie expiration date (two weeks) (digital is the number of seconds) (default) SESSION_EXPIRE_AT_BROWSER_CLOSE is = False # if you close the browser makes Session expired (default) = False SESSION_SAVE_EVERY_REQUEST # whether each request Save Session, was saved after modifying default (default)
note:
ESSION_SAVE_EVERY_REQUEST = True
And SESSION_EXPIRE_AT_BROWSER_CLOSE = True
to simultaneously set up, otherwise it will lead to the expiration time can not take effect