Reputation: 110163
I have created a view at example.views.py
, and here is my urls.py file:
from django.urls import path
urlpatterns = [
path('/', example.views.index, name='index'),
]
However, when I run django's runserver, I get the following error:
path('/', example.views.index, name='index'),
NameError: name 'example' is not defined
What do I need to do to fix this? Quoting the view doesn't help either.
Upvotes: 1
Views: 92
Reputation: 1994
Try changing it to:
from django.urls import path
from example import views
urlpatterns = [
path('/', views.index, name='index'),
]
Upvotes: 1