Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 621455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:52:34+00:00 2026-05-13T18:52:34+00:00

Why is this running into an infinite loop, and ‘TESTING’ never gets printed? It

  • 0

Why is this running into an infinite loop, and ‘TESTING’ never gets printed? It seems like the logout function is causing the page to redirect to itself, but the documentation suggests that you can put your own redirect after calling that function.

def logout(request):
    logout(request)
    print 'TESTING'
    messages.success(request, 'Logged out.')
    return HttpResponseRedirect(request.GET['next'] or reverse('home'))

Is there another way to log the user out, if this logout function has some hidden redirect functionality?


Just took a peek at the source code, nothing suspicious there:

def logout(request):
    """
    Removes the authenticated user's ID from the request and flushes their
    session data.
    """
    request.session.flush()
    if hasattr(request, 'user'):
        from django.contrib.auth.models import AnonymousUser
        request.user = AnonymousUser()

I really can’t imagine what’s causing this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:52:34+00:00Added an answer on May 13, 2026 at 6:52 pm

    You have written:

    def logout(request):
        logout(request)
    

    which means You call the view itself – not the logout function.

    You can fix this by writing:

    from django.contrib import auth
    # ...
    def logout(request):
        auth.logout(request)
        # ...
    

    In addition You do not have to write own logout view – it is given already by default as django.contrib.auth.views.logout.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I running into an infinite loop problem. I have two numeric up/down controls (Height
I wrote this function to inject DLL into running process: DLL_Results CDLL_Loader::InjectDll() { DWORD
I keep running into this design problem, and I'm not happy with my solution
I'm running into this problem when trying to call a SOAP Web Service from
I remember running into this problem when I started using OpenGL in OS X.
I keep running into this error MemCacheError (Broken pipe): Broken pipe on my Rails
Following this tutorial and running into trouble. [TestMethod] [ExpectedException(typeof(Exception))] public void VerifyPropertyNameMethod_NonExistentPropertyString_ThrowsException() { var
So I am running into this problem. I am trying to use $.get() to
I'm currently using Entity Framework and am running into this issue: The relationship between
After changing the import as a from-import i'm running into this error: from datetime

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.