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 : *[email protected]*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*
On 22/05/18 16:27, Avitab Ayan Sarmah wrote:
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'),
]
On Friday, May 18, 2018 at 10:42:17 PM UTC+5:30, James Farris wrote:
What does your urls.py look like?
According to the error it doesn’t appear that polls/ is defined in
your urls.py file
On Fri, May 18, 2018 at 10:05 AM Avitab Ayan Sarmah
<[email protected] <javascript:>> wrote:
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.
--
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 [email protected]
<javascript:>.
To post to this group, send email to
[email protected] <javascript:>.
Visit this group at
https://groups.google.com/group/django-users
<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
<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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
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.
--
--
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 [email protected].
To post to this group, send email to [email protected].
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/1b976379-41c5-27ed-36e7-a2e938876df8%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.