Most optimized way to delete all sessions for a specific user in Django?

后端 未结 5 1321
感动是毒
感动是毒 2021-02-01 18:40

I\'m running Django 1.3, using Sessions Middleware and Auth Middleware:

# settings.py

SESSION_ENGINE = django.contrib.sessions.backends.db   # Persist sessions          


        
5条回答
  •  说谎
    说谎 (楼主)
    2021-02-01 18:56

    This is not a direct answer, but it solves your problem and reduces DB hits to zero. With recent versions of Django you can use the cookie based session backend:

    https://docs.djangoproject.com/en/dev/topics/http/sessions/#cookie-session-backend

提交回复
热议问题