NoReverseMatch at / Reverse for 'logout' not found. 'logout' is not a valid view function or pattern name.

I got this error with my first project while I try to use the app and reorganize the route. I have checked everything and still can’t fix it. Any help is deeply appreciated. Thank you!!

Here is my navigation code:
{% if user.is_authenticated %}
            {% url 'accounts:profile' as profile_url %}
            <span>Hi {% if request.path == profile_url %}{{user.username}}{% else %}<a href="{{ profile_url }}">{{user.username}}</a>{% endif %}</span>
            <span><a href="{% url 'logout' %}">Logout</a></span>
        {% else  %}
            <span><a href="{% url 'login' %}">Login</a></span>
        {% endif %}
My app:  accounts code
from django.urls import path
from django.contrib.auth import views as auth_views

from . import views
app_name = "accounts"
urlpatterns = [
    path("accounts/profile", views.ProfileView.as_view(), name="profile"),
    # Django Auth
    path("accounts/logout", auth_views.LogoutView.as_view(), name="logout"),

Try reversing the url name using the app_name:url_name format:

It worked!! Thank you so much~
Also forgot put this
<a href="{% url 'accounts:login' %}">