How to configure where to redirect after a log out in Django?

后端 未结 11 1217
情书的邮戳
情书的邮戳 2020-12-02 09:48

Just wondering where I can set the url to redirect to after logout. I know you can set the login url. I want to redirect to my home page.

11条回答
  •  臣服心动
    2020-12-02 09:59

    If you want to set the redirection URL on client level, you can do it in the urls.py:

    (r'^management/logout/$', 'django.contrib.auth.views.logout'),
    

    And then in the template:

    
        Log out
    
    

    Where the next, you point to the right URL.

提交回复
热议问题