Why second user login redirects me to /accounts/profile/ url?

前端 未结 7 2530
忘掉有多难
忘掉有多难 2021-02-03 19:13

I am using Django built in view for user login:

url(r\'^user/login/$\', \'django.contrib.auth.views.login\', {\'template_name\': \'users/templates/login.html\'},         


        
7条回答
  •  面向向阳花
    2021-02-03 19:25

    when you use the view build in django. and you are successfully logged in. django.contrib.auth.views.login which is the django view you used.

    It has inside a parameter called LOGIN_REDIRECT_URL that automatically redirects you after logging in. and is by default configured with Default: '/ accounts / profile /'.

    wich is The URL or named URL pattern where requests are redirected after login when the LoginView doesn’t get a next GET parameter. says documentation

    https://docs.djangoproject.com/en/3.1/ref/settings/#std:setting-LOGIN_REDIRECT_URL

    Try adding this to the html page form you use to login.

提交回复
热议问题