The debug suggest that it only tried to match the admin pattern but
nothing else,
that sugggests to me that you missed this bit in the mysite/urls.py
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),
]
You notice that this now has two patterns - 'polls' and 'admin', but
your debug message didn't mention trying the 'polls/' pattern, which
suggests that the 'polls/' bit is missing from this file.
To help you debug this sort of thing in future - a quick tutorial might help
* When Django gets a request for a URL, then it checks the project
'urls.py' first - it is expected that the project 'urls.py' will
contain a list of specific urls for the project, and then will
include the 'urls.py' for the various apps within the project.
* If Django is unable to find a match for the url provided - and DEBUG
is TRUE then Django will tell you what paths it tried to match on -
so it will list everything in the project 'urls.py' and then the
patterns from any app 'urls.py' if it finds a match - and so on.
* So for instance with the correct project 'urls.py' and the polls
'url.py' as given in the tutorial, if you tried to get a url of :
'
http://localhost:8000/polls/python' - you would get a DEBUG message
something like :
Using the URLconf defined in mysite.urls, and polls.urls Django tried these URL patterns, in this order:
admin/
polls/
The current path, polls/python, didn't match any of these.
Django has matched the 'polls' bit of the URL with the 'polls'
pattern in 'mysite/urls.py', it will now try to match the python
bit of the URL within the 'polls/url.py' - but of course wont be
able to, because that 'urls.py' only has a blank pattern.
--
Tony
--
--
Anthony Flury
email : *
Anthon...@btinternet.com*
Twitter : *@TonyFlury <
https://twitter.com/TonyFlury/>*