一种更简单的方法:
在你的登出请求网址中添加“下一个”参数。例如:
<a href="{% url 'auth_logout' %}?next=/path_to_the_page"> Logout</a>然后,注销视图将为你解决问题。
对于登录后重定向,你只需在settings.py中进行设置即可:
LOGIN_REDIRECT_URL = '/path_to_the_page'LOGIN_URL = '/path_to_the_page'

一种更简单的方法:
在你的登出请求网址中添加“下一个”参数。例如:
<a href="{% url 'auth_logout' %}?next=/path_to_the_page"> Logout</a>然后,注销视图将为你解决问题。
对于登录后重定向,你只需在settings.py中进行设置即可:
LOGIN_REDIRECT_URL = '/path_to_the_page'LOGIN_URL = '/path_to_the_page'