when i am trying to hard reload by pressing ctrl+shift+R my session is automatically logging off.
please tell me how django session are working behind the scene.
when i am trying to hard reload by pressing ctrl+shift+R my session is automatically logging off.
please tell me how django session are working behind the scene.
It doesn’t behave that way for me.
Sessions are (normally) a cookie named sessionid
that are passed back and forth for each request and response. As long as the same cookie is being exchanged, you’ll remain logged in.
I’d look at the Network tab in your browser’s developer tools to see what cookies are being exchanged for each request.
how to check m using same cookie?
because in the browser i am able to login. but i am hard reloading the page then cookies get cleared and it is throwing me on login page.
In the Request Headers, you’ll see a line for Cookie:
, and in the Response Headers you’ll see a line for Set-Cookie
When you submit your credentials, you’re issuing a POST request to your login view. That response contains the sessionid
cookie. Your browser should then be returning that same cookie on all subsequent requests.
Are you working with the standard login view, or are you using a modified view? If you’re using a modified view, you might be doing something wrong.
i am using django dbrouters to route through my databases. during the switch of db my application is getting logout.
Ok, that explains a lot, if you’re trying to route access to the sessions model. You don’t want to route access to it, you want all references to it to remain in the default database.