[Answered ]-Django NameError: name ' ' is not defined

1👍

In your urls.py.

if import is used like this:

from . import views

# then use:
path('politics/', views.PoliticalPostListView.as_view(), name='political-posts'),

But if using:

from .views import PoliticalPostListView

# then use:
path('politics/', PoliticalPostListView.as_view(), name='political-posts'),

Leave a comment