Hi guys,
New here to django. Going through the tutorial, on part 3, I set up the mysite/polls/urls.py file  like this according to the instructions:

-----
from django.urls import path
from . import views

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'),
]
-----

Then I set up the /mysite/polls/views.py file like this according to the instructions:

-----
from django.http import HttpResponse
from .models import Question

def index(request):
    latest_question_list = Question.objects.order_by('-pub_date')[:5]
    output = ', '.join([q.question_text for q in latest_question_list])
    return HttpResponse(output)

def detail(request, question_id):
    return HttpResponse("You're looking at question %s." % question_id)

def results(request, question_id):
    response = "You're looking at the results of question %s."
    return HttpResponse(response % question_id)

def vote(request, question_id):
    return HttpResponse("You're voting on question %s." % question_id)
-----

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

I get this:

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

1. admin/
2. polls [name='index']
3. polls <int:question_id>/ [name='detail']
4. polls <int:question_id>/results/ [name='results']
5. polls <int:question_id>/vote/ [name='vote']

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


I cannot see what the error is that I am making. Any ideas? Thanks in advance.

--
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/112f7336-14e3-9e47-850b-3601ebecec52%40gmail.com.

Reply via email to