Yes, that should be an absolute url - “/ISO22301/logout/”
In general terms there are a couple of things that should probably be improved.
-
I understand wanting to understand how authentication “works”. But in general, you should be using the system views for login / logout. (See Using the Django authentication system | Django documentation | Django). (The system-provided LoginView provides additional security protections and support for features and edge-cases not accounted for in the view you’re using here.)
-
Even if you choose not to do that, you should not be using a “GET” on a logout. (See Django 4.1 release notes | Django documentation | Django For why this was done, see the references posted at Deprecation of GET method for LogoutView - #2 by KenWhitesell)
Side note: As a general rule, it’s always more helpful if you post the exceptions with the stack trace that appear in the runserver
console instead of the summary messages presented in the browser. I think we need to see that to try and address the recursion error. We’ll probably also need to see the logout.html
template.