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


On 12 Nov 2020, at 04:35, George Olson wrote:

I don't quite follow your note there of just going to:
http://127.0.0.1:8000/
without the app name 'polls' following.

I believe you have to put the app name following that. It was working before with http://127.0.0.1:8000/polls/, but then I did something and tried to backtrack and the whole system got messed up. I tried to reset everything back to the original but it is still not working.

On Wednesday, November 11, 2020 at 7:47:58 PM UTC-6 Clive Bruton wrote:

On 11 Nov 2020, at 23:37, George P. Olson wrote:

> So when I go to this url: http://127.0.0.1:8000/polls/

Although the urlpatterns below shows "# ex: /polls/", the defined
path has no path elements, so you just need:

http://127.0.0.1:8000/

I think.

> urlpatterns = [
> # ex: /polls/
> path('', views.index, name='index'),...


-- 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+unsubscr...@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.

--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6B7CE16C-69CD-4291-AC32-A81D54023029%40indx.co.uk.

Reply via email to