getting error while reloading the url"http://localhost:8000/polls/".The error is given below.Please tell my why i am seeing this error?

75 views
Skip to first unread message

Avitab Ayan Sarmah

unread,
May 18, 2018, 1:05:05 PM5/18/18
to Django users

Page not found (404)

Request Method:GET
Request URL:http://localhost:8000/polls/

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

  1. [name='index']
  2. <int:pk>/ [name='detail']
  3. <int:pk>/results/ [name='results']
  4. <int:question_id>/vote/ [name='vote']
  5. 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.

James Farris

unread,
May 18, 2018, 1:12:17 PM5/18/18
to django...@googlegroups.com
What does your urls.py look like?

According to the error it doesn’t appear that polls/ is defined in your urls.py file

--
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 post to this group, send email to django...@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/54b07f4e-663c-4ed0-a419-541d735148a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Melvyn Sopacua

unread,
May 19, 2018, 1:18:07 PM5/19/18
to django...@googlegroups.com
If you're going to send each error you get to the list to be resolved, you're
not going to learn any debugging skills.

Errors have all the information for you to figure out yourself why things are
wrong. Read them, follow the back traces and figure it out.

There are times where backtraces are hard to read or do not have the answer in
an obvious way. But so far, you haven't encountered those at all.

--
Melvyn Sopacua

Avitab Ayan Sarmah

unread,
May 22, 2018, 11:27:17 AM5/22/18
to Django users
Mysite\urls.py:
from django.contrib import admin
from django.urls import include, path

urlpatterns = [
path('', include('polls.urls')),
path('admin/', admin.site.urls),
]

polls\urls.py:
from django.urls import path

from . import views

app_name = 'polls'
urlpatterns = [
# ex: /polls/
path('', views.IndexView.as_view(), name='index'),
# ex: /polls/5/
path('<int:pk>/', views.DetailView.as_view(), name='detail'),
# ex: /polls/5/results/
path('<int:pk>/results/', views.ResultsView.as_view(), name='results'),
# ex: /polls/5/vote/
path('<int:question_id>/vote/', views.vote, name='vote'),
]

Anthony Flury

unread,
May 22, 2018, 1:01:21 PM5/22/18
to django...@googlegroups.com
In your MySite\urls.py :

urlpatterns = [
path('', include('polls.urls')),
path('admin/', admin.site.urls),
]


should be

urlpatterns = [
path('polls', include('polls.urls')),
path('admin/', admin.site.urls),
]

Django doesn't assume that the url should be <hostname>/polls - just
because the app name is 'polls' - you have to be explicit about the url
path that needs to be matched.
--
Anthony Flury
email : *Anthon...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*
> Using the URLconf defined in |mysite.urls|, Django tried these
> URL patterns, in this order:
>
> 1. [name='index']
> 2. <int:pk>/ [name='detail']
> 3. <int:pk>/results/ [name='results']
> 4. <int:question_id>/vote/ [name='vote']
> 5. 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.
>
> --
> 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
> <javascript:>.
> To post to this group, send email to
> django...@googlegroups.com <javascript:>.
> <https://groups.google.com/group/django-users>.
> <https://groups.google.com/d/msgid/django-users/54b07f4e-663c-4ed0-a419-541d735148a1%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
> --
> 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
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@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/0d8bf4ad-99dc-4c0e-8341-1084e15daf75%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/0d8bf4ad-99dc-4c0e-8341-1084e15daf75%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


--

김영찬

unread,
May 22, 2018, 2:29:47 PM5/22/18
to django...@googlegroups.com
urlpatterns = [
path('', include('polls.urls')),
path('admin/', admin.site.urls)
]

In this chuck of code, you should write like this,

urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),
]

2018년 5월 23일 (수) 오전 12:27, Avitab Ayan Sarmah <avita...@gmail.com>님이 작성:

Umar Kambala

unread,
May 23, 2018, 5:52:48 AM5/23/18
to django...@googlegroups.com

Plz I need ur help, I found this error TemplateDoesNotExit at polls/1/

To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.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+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Avitab Ayan Sarmah

unread,
May 23, 2018, 5:54:40 AM5/23/18
to django...@googlegroups.com
Show your URLs.py

--
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 post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/IbThyW5L5mw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages