I'm writing a module to store comments for specific article. My model contains a column unique_session which is intended to store the commenter's browsing session id.
Within my view function, I'm trying to initialize a variable bearing the value of request.COOKIES['sessionid'] which I later assign to unique_session column of the model.
So far, I'm doing good with Chrome. I'm able to get it as the key exists when I inspect it, and obviously it stores to db just fine.
But when I go to Firefox, the sessionid cookie does not exist and Django throws in a KeyError.
Anyone have any idea what could be missing?
P.S. I was not manually creating the sessionid cookie. I saw it exists in Chrome so I just used it instead of creating my own 32-bit session key. Then I later realized that it does not exist on Firefox. So I have no idea when/where it gets created and why not on Firefox.





request.session.session_keyis what @DanielRoseman intends. By explicitly using the cookie you're making assumptions on how the session id is passed around.