#32952: Since i removed sessionid in browser cookies, django is not creating new
one
-------------------------------------+-------------------------------------
Reporter: Inexpli | Owner: nobody
Type: Bug | Status: new
Component: | Version: 3.2
contrib.sessions |
Severity: Normal | Keywords: session, cookies
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
While i was creating shopping cart which depends on sessionid included in
cookie files I once removed sessionid in my browser to test something and
then i realised that django don't want to recreate new one. I was looking
for solution in internet but i didn't found any equal problem to my and
solution to it.
By looking on the django docs. i wrote to setting.py hoping that it would
help:
{{{
SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'
SESSION_COOKIE_HTTPONLY = True
}}}
but still sessionid in cookies doesn't occur.
I read post that sessionid should be generated by django while there is
request which require sessionid, and it would be in my situation solution
on this problem but in the context_processors.py I wrote that i require
sessionid globally:
{{{
def basket(request):
try:
customer = request.user.customer
except:
device = request.COOKIES['sessionid']
customer, created = Customer.objects.get_or_create(device=device)
order, created = Order.objects.get_or_create(
customer=customer, complete=False)
return {
'order': order,
}
}}}
And beacouse of the context_processors sends request for sessionid and it
can't get one, this error occurs:
https://i.stack.imgur.com/D3d9U.png
--
Ticket URL: <https://code.djangoproject.com/ticket/32952>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.ac3a7d6001b55518364b36accd0976c5%40djangoproject.com.