NoReverseMatch error . Reverse for '...' not found

Viewed 162

I was trying to implement dynamic urls in Django when this occured

In my template.py, I added this line

 <a href="{% url 'Index' %}" role="button">Go to Index</a>

My urls.py

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path("admin/", admin.site.urls),
    path("", include("moviez.urls"))
]

My moviez.urls.py

from django.urls import path
from .views import IndexView

app_name = "moviez"

urlpatterns = [
    path("", IndexView, name="Index")
]

I think this should definitely should have work but it returned this error

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

Can you please help me debug this?

Any help will be appreciated!

1 Answers
Related