How to use session in django??

35 views
Skip to first unread message

meera gangani

unread,
Jun 15, 2020, 12:36:38 AM6/15/20
to django...@googlegroups.com
Hello ,
     How To use session in django
Can you please help me out!


Thanks in advance
-Meera Gangani

cosmos multi

unread,
Jun 15, 2020, 12:57:00 AM6/15/20
to django...@googlegroups.com
I use sessions more for what shopping carts are, saving information temporarily.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANaPPP%2BAoBVbpM9-jwoevd8tVkep8YasFt6VSRD1M2bfP-bjcg%40mail.gmail.com.

Doddahulugappa.B

unread,
Jun 15, 2020, 2:18:40 AM6/15/20
to django...@googlegroups.com
Refer below

first, you need to install Django-session-timeout with the command:

pip install django-session-timeout

then you need to update your SessionTimeoutMiddleware in settings.py

MIDDLEWARE_CLASSES = [
     ...
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django_session_timeout.middleware.SessionTimeoutMiddleware',
     ...
]

at last, you need to add SESSION_EXPIRE_SECONDS at the end of settings.py:

SESSION_EXPIRE_SECONDS = 300  # 300 seconds = 5 minutes

Virus-free. www.avast.com

--
Reply all
Reply to author
Forward
0 new messages