Your logout code as is doesn't work with the latest version of Django.
<a class="btn btn-primary btn-lg" href="{% url 'logout' %}" role="button">Logout</a>
I was getting a 405 error. After some research I changed the code to:
<form id="frm_logout" method="post" action="{% url 'logout' %}">
{% csrf_token %}
<a href="javascript:$('#frm_logout').submit();" class="btn btn-primary btn-lg" role="button">Logout</a>
</form>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
After I made the changes I could logout and then the logout.html page would be displayed.