Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignores SESSION_ENGINE setting #44

Open
misli opened this issue Sep 23, 2019 · 2 comments
Open

Ignores SESSION_ENGINE setting #44

misli opened this issue Sep 23, 2019 · 2 comments

Comments

@misli
Copy link

misli commented Sep 23, 2019

  • django-private-chat version: 0.2.2

Description

I use SESSION_ENGINE = 'django.contrib.sessions.backends.cache' setting in my projects.
django-private-chat however fails with django.contrib.sessions.models.DoesNotExist: Session matching query does not exist., which means that it uses django.contrib.sessions.models.Session directly, ignoring the configured session engine.

@delneg
Copy link
Collaborator

delneg commented May 3, 2020

Please submit an example of proper usage of session engine

@ledzgio
Copy link

ledzgio commented Oct 5, 2020

Same issue here, any update?

UPDATE:
a quick fix is to change the get_user_from_session in utils.py into the following:

`
async def get_user_from_session(session_key):

session_key = "django.contrib.sessions.cache{}".format(session_key)
session = cache.get(session_key)
if session:
    uid = session['_auth_user_id']
    user = get_user_model().objects.filter(id=uid).first()  # get object or none
    return user
else:
    return None

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants