In my settings.py
I have SESSION_EXPIRE_AT_BROWSER_CLOSE = True
. I am not sure if that is the right place to do that and if need to import anything first. But it wasn't working on Chrome Version 37.0.2062.124 m as it persists the session data. My session-dependent page still opens even after closing and re-opening the browser.
So, I manually cleared the session data (csrftoken
, sessionid
and Database Data
in Chrome's Settings session is no longer working at all. Even if I login and try to open home
page in another tab of the same browser (Chrome, Firefox, IE, Safari) I get redirected to login
page.
def index(request): #login page.
if 'id' in request.session:
Proceed to Home Page
if request.method == 'POST':
Do the needful
set request.session['id']
proceed to Home Page
return render(request, 'myapp/index.html')
def home(request): #homp page
if 'id' not in request.session:
redirect to login page
return render(request, 'myapp/home.html')
How do I go about making this work?