django-sessions Questions

5

In Django, I have SESSION_COOKIE_DOMAIN set to my domain name. But I would actually like to run the same site with two different domain names. With SESSION_COOKIE_DOMAIN set, only the named domai...
Blisse asked 22/1, 2010 at 11:27

6

Solved

Does this table need to be purged or is it taken care of automatically by Django?
Padang asked 3/9, 2011 at 22:10

2

I need to logout a user after some specific time(lets take it as 1 min for now), and so created a middleware class as below myproject/middleware.py from datetime import datetime, timedelta from d...
Rockel asked 28/7, 2015 at 7:42

3

Solved

I set data to session with 'cart' key: request.session['cart'] = {'8': ['a', 'b'], '9': ['c', 'd']} Then, I could delete all the session data with 'cart' key: del request.session['cart'] But, I c...
Kipp asked 12/8, 2014 at 21:54

1

I tried both request.session.clear() and request.session.flush() and they deleted all session data and logged a user out. Actually, there is the explanation for request.session.flush() as shown bel...
Westmoreland asked 8/7, 2023 at 16:47

3

Solved

I have a pretty simply utility function that gets an open web order if their is a session key called 'orderId', and will create one if there is no session key, and the parameter 'createIfNotFound' ...
Scapegrace asked 12/9, 2016 at 19:22

2

I could properly experiment when session is and isn't saved in Django as shown in my answer referring When sessions are saved. *I use Django 4.2.3. But if I run all cases together as shown below (T...
Pentobarbital asked 6/7, 2023 at 18:55

2

I'm trying to experiment when session is and isn't saved with the 4 cases of code below in When sessions are saved but I don't know how to do it: # Session is modified. request.session["foo&qu...
Linc asked 5/7, 2023 at 15:51

9

Solved

I'm aware that you can get session variables using request.session['variable_name'], but there doesn't seem to be a way to grab the session id(key) as a variable in a similar way. Is this documente...
Cryptonym asked 8/2, 2009 at 18:31

5

Solved

I'm working on a website that requires us to log a user out after N minutes of inactivity. Are there any best practices for this using Django?
Favorable asked 29/3, 2010 at 15:24

11

Solved

I'm using this to login the user in: def login_backend(request): if request.method == 'POST': username = request.POST['username'] password = request.POST['password'] user = authenticate(usernam...
Sagacity asked 12/2, 2013 at 10:45

3

Solved

From django's documentation, I became under the impression that calling: request.session.set_expiry(300) from one view would cause the session to expire after five minutes inactivity; however, thi...
Supplejack asked 2/9, 2009 at 6:42

3

I need to set a variable on session, when a user login happens. How can I do this? if request.user.is_authenticated(): profile = request.user.get_profile() request.session['idempresa'] = profile....
Lacylad asked 22/1, 2013 at 18:59

2

Solved

I can't find a setting for the default session lifetime in https://docs.djangoproject.com/en/1.10/ref/settings/. I know this can be changed manually (How to expire Django session in 5minutes?).
Synthesize asked 12/1, 2017 at 13:54

1

Solved

Django cycles the session key upon login. The rationale (that I don't understand) is in this pull request: When logging in, change the session key whilst preserving any existing sesssion. This mea...
Unmistakable asked 7/10, 2021 at 18:14

6

Solved

I'm running Django 1.3, using Sessions Middleware and Auth Middleware: # settings.py SESSION_ENGINE = django.contrib.sessions.backends.db # Persist sessions to DB SESSION_COOKIE_AGE = 1209600 # C...

5

Solved

I'm using Django sessions and I would like a way of seeing the session data in the admin interface. Is this possible? I.e. for each session I want to see the data stored in the session database (w...
Keenan asked 12/2, 2011 at 2:55

2

Solved

I would like to know if auth.logout clears session data or i have to do it by my self. from django.contrib.auth.decorators import login_required from django.contrib import auth @login_required def...

3

Solved

I'm trying to write some tests for my django app and it's throwing up an error: File "/Users/croberts/.virtualenvs/litem/lib/python3.4/site-packages/django/contrib/auth/__init__.py", line 101, in ...
Peridotite asked 26/2, 2016 at 19:2

2

I am creating a conversational chatbot using django . And To maintain the flow of the chat in chatbot , i am using django sessions . But when i use the link of the chatbot in an iframe , it doesn't...
Atalanta asked 5/12, 2018 at 7:15

1

I want to use the most secure method to store my logged in users session in a cookie. the backend is built on Django & DRF, so I'm choosing between the simplejwt plugin for token auth or django...

2

I am currently getting spammed by the error: dictionary update sequence element #0 has length 14; 2 is required that seems to be provoked by ('SessionStore' object has no attribute '_session_cache...
Microseism asked 16/2, 2019 at 10:33

1

This is my current sessionId cookie attributes: Set-Cookie: sessionid=3jdpjxgepk49vrnhbabdvju3r80ci581; expires=Mon, 06-Aug-2018 12:40:14 GMT; HttpOnly; Max-Age=1209600; Path=/ I want sessionI...
Mancilla asked 23/7, 2018 at 10:42

2

I'm using AWS Elastic Beanstalk with EC2 servers behind an Elastic Load Balancer (ELB). I have "sticky sessions" on the ELB enabled because that's the only way I can get django user sessions to wo...

3

Our Django deployment checks every night which active users can still be found in out LDAP directory. If they cannot be found anymore, we set them to inactive. If they try to login next time, this ...
Leonor asked 11/8, 2014 at 20:19

© 2022 - 2025 — McMap. All rights reserved.