相关疑难解决方法(0)

如何在Django中注销后重定向的位置?

只是想知道我可以在注销后将URL设置为重定向到哪里.我知道你可以设置登录URL.我想重定向到我的主页.

authentication django

80
推荐指数
6
解决办法
7万
查看次数

Django注销无法正常工作

我似乎遇到了与此问题相同的问题: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 /): …

django logout

11
推荐指数
2
解决办法
1万
查看次数

标签 统计

django ×2

authentication ×1

logout ×1