django logout redirects me to administration page

前端 未结 11 2121
生来不讨喜
生来不讨喜 2020-12-14 14:32

I have provided a simple login functionality. For logout, I tried to use the built-in one. This is my urls.py:

(r\'\', include(\'django.contrib.auth.urls\'))         


        
11条回答
  •  我在风中等你
    2020-12-14 15:35

    Go to settings.py and add this code. "/" will redirect you to home

    # Where to redirect during authentication
    LOGIN_REDIRECT_URL = "/" #To go to home after login instead of getting redirected to accounts/profile on login which is default
    LOGOUT_REDIRECT_URL = "/" #To logout back to the home page instead of the default admin logout page
    

提交回复
热议问题