Sorry, I just checked my version of the tutorial, you load the
manage.py through the directory "mysite", and "polls" is in a sub-
directory. The way you showed the "/polls/urls.py" implied that was
the only file, where in fact the root app/settings are at "/mysite/
settings.py" and urls at "/mysite/urls.py".
Because "/mysite/urls.py" has an include for "polls/urls.py" it
implies the path "/polls".
It's a bit tricky to diagnose, because you are now saying it was
working, but then you changed stuff. My directory setup looks like this:
/mysite/manage.py
...
/mysite/mysite/settings.py
...
/mysite/mysite/urls.py
...
/mysite/polls/settings.py
...
/mysite/polls/urls.py
I checked my polls.py, which looks like this:
*************
from django.urls import path
from . import views
app_name = 'polls'
"""
urlpatterns = [
# ex: /polls/
path('', views.index, name='index'),
# ex: /polls/5/
path('<int:question_id>/', views.detail, name='detail'),
# ex: /polls/5/results/
path('<int:question_id>/results/', views.results, name='results'),
# ex: /polls/5/vote/
path('<int:question_id>/vote/',
views.vote, name='vote'),
]
"""
urlpatterns = [
path('', views.IndexView.as_view(), name='index'),
path('<int:pk>/', views.DetailView.as_view(), name='detail'),
path('<int:pk>/results/', views.ResultsView.as_view(),
name='results'),
path('<int:question_id>/vote/',
views.vote, name='vote'),
]
***************
I think I read recently that generic views like "IndexView" need a
".as_view()" attached to the end to be recognised.
-- Clive
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to
django-users...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/
> d/msgid/django-users/1feb0c4a-8919-4aff-abb1-e0110392c396n%
>
40googlegroups.com.