Django logout problem

后端 未结 5 1762
轻奢々
轻奢々 2021-02-09 08:05

Here is the problem I am facing with the Django Authenetication

  1. Access a page that requires a login.
  2. Logout (accessing django.contrib.auth.logout)
  3. <
5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-09 08:36

    In Django 1.4.* I've had problems with the logout() function. It simply wasn't logging out my users.

    Now I'm just using the contributed view to logout users and it works perfectly. Simply add this to your root urls.py file if you don't want to do anything else special:

    (r'^logout/$', 'django.contrib.auth.views.logout', {'next_page': '/login'}),
    

    and you'll be good to go.

    Happy Djangoing.

提交回复
热议问题