By default, Django keeps your sessions even if you close the browser. To change this behaviour, just add the following line in your settings. py
SESSION_EXPIRE_AT_BROWSER_CLOSE=True
However, There might be existing sessions in the session store. We need to clean them up first. Comment out SESSION_EXPIRE_AT_BROWSER_CLOSE=True. Restart Apache server.
#SESSION_EXPIRE_AT_BROWSER_CLOSE=True
SESSION_COOKIE_AGE = 5 # 5 seconds for testing
SESSION_SAVE_EVERY_REQUEST = True
You will see in 5 seconds, session will be deleted. Now delete those 2 lines and just leave SESSION_EXPIRE_AT_BROWSER_CLOSE=True. Now it must work properly.
SESSION_EXPIRE_AT_BROWSER_CLOSE=True