Manually logging out a user, after a site update in Django
-
12-09-2019 - |
Question
I have a website, which will be frequently updated. Sometimes changes happen to User specific models and are linked to sessions.
After I update my site, I want the user to log out and log back in. So I would log out the user right then. If he logs back in, he will see the latest updates to the site.
How do I do it?
Solution
You could just reset your session table. This would logout every user. Of course, depending on what your doing with sessions, it could have other implications (like emptying a shopping cart, for example).
python manage.py reset sessions
Or in raw SQL:
DELETE FROM django_sessions
OTHER TIPS
See this: http://docs.djangoproject.com/en/dev/topics/auth/#how-to-log-a-user-out
That seems to cover it.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow