Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

django logout

from django.contrib.auth import logout

def logout_view(request):
    logout(request)
    # Redirect to a success page.
-------------------------------------------------------------------

# add in settings.py (optional)

LOGOUT_REDIRECT_URL = url_to_be_redirected_after_logout

### if you add the LOGOUT_REDIRECT_URL you  don't have to redirect to success page in the view ###
### because it will automatically redirect the user to the url you provided in settings.py ###
 
PREVIOUS NEXT
Tagged: #django #logout
ADD COMMENT
Topic
Name
7+7 =