[Django] #32952: Since i removed sessionid in browser cookies, django is not creating new one

33 views
Skip to first unread message

Django

unread,
Jul 20, 2021, 11:36:42 AM7/20/21
to django-...@googlegroups.com
#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.

Django

unread,
Jul 20, 2021, 11:39:48 AM7/20/21
to django-...@googlegroups.com
#32952: Django is not generating new session
----------------------------------+--------------------------------------

Reporter: Inexpli | Owner: nobody
Type: Bug | Status: new
Component: contrib.sessions | Version: 3.2
Severity: Normal | Resolution:
Keywords: session, cookies | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/32952#comment:1>

Django

unread,
Jul 20, 2021, 12:50:14 PM7/20/21
to django-...@googlegroups.com
#32952: Django is not generating new session
----------------------------------+--------------------------------------
Reporter: Inexpli | Owner: nobody
Type: Bug | Status: closed
Component: contrib.sessions | Version: 3.2
Severity: Normal | Resolution: invalid
Keywords: session, cookies | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => invalid


Comment:

Please don't use Trac as a support channel. Closing per
TicketClosingReasons/UseSupportChannels.

--
Ticket URL: <https://code.djangoproject.com/ticket/32952#comment:2>

Reply all
Reply to author
Forward
0 new messages