只是想知道我可以在注销后将URL设置为重定向到哪里.我知道你可以设置登录URL.我想重定向到我的主页.
我似乎遇到了与此问题相同的问题:Django注销问题
我有点怪,它适用于谷歌Chrome ....但不是在Firefox ...
这是我的注销功能:(在views.py中)
def my_logout(request):
logger.debug("Logout called by user")
try:
# Here I do some custom stuff, like logging this action in a database and so on
# For this question it shouldn't matter... because in a try catch
# so whatever goes wrong here, logging out should work anyway
except Exception, e:
logger.info("Logging logout action error: %s" % e)
logout(request)
return HttpResponseRedirect("/")
Run Code Online (Sandbox Code Playgroud)
在settings.py我有:
LOGIN_URL = '/desktop/login/'
LOGOUT_URL = '/desktop/logout/'
LOGIN_REDIRECT_URL = '/'
Run Code Online (Sandbox Code Playgroud)
在app iamapps的urls.py中(在项目网址中包含/ desktop /): …