@deprecate_current_app
def logout_then_login(request, login_url=None, extra_context=None):
    if not login_url:
        login_url = settings.LOGIN_URL
    login_url = resolve_url(login_url)
    return logout(request, login_url, extra_context=extra_context)
Logs out the user if they are logged in. Then redirects to the log-in page.
dataset/ETHPy150Open django/django/django/contrib/auth/views.py/logout_then_login