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 :

       Page not found (404)
       Request Method:  GET
       Request URL:     http://127.0.0.1:8000/polls/

       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

On 23/04/18 15:43, aljomaih...@live.com wrote:
hi. i'm new to django dev. so i'm following the tutorial at 
https://docs.djangoproject.com/en/2.0/intro/tutorial01/

i copied and pasted the code samples so as not to introduce typing mistakes. everything 
works fine until i reached the "polls" section. i get below errors:

Page not found (404)
Request Method:         GET
Request URL:    http://127.0.0.1:8000/polls/

Using the URLconf defined in mysite.urls, Django tried these URL patterns, in 
this order:

     admin/

The current path, polls/, didn't match any of these.

You're seeing this error because you have DEBUG = True in your Django settings 
file. Change that to False, and Django will display a standard 404 page.

when i open http://127.0.0.1:8000/polls/

what could be the reason?


--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6ebe4d08-9def-d14c-52a9-f4cb88b971a5%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to