title: Why do I have this error in Django?
body: <p>I'm following the Django tutorial process, currently located on part 6.</p>
  
  <p>I get an error when I click on the list from my web page. I looked up where the problem occurred, but I could not find it.</p>
  
  <p>This is the message from a web browser:</p>
  
  <pre><code>Page not found (404)
  Request Method: GET
  Request URL:    http://localhost:8000/polls/1//
  Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
  
  polls/ [name='index']
  polls/ &lt;int:pk&gt;/ [name='detail']
  polls/ &lt;int:pk&gt;/results/ [name='results']
  polls/ &lt;int:question_id&gt;/vote/ [name='vote']
  admin/
  The current path, polls/1//, 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.
  </code></pre>
  
  <p>traceback<br>
  "GET /polls/1// HTTP/1.1" 404 2703</p>
  
  <p>mysite/polls/views.py</p>
  
  <pre><code>from django.http import HttpResponse, HttpResponseRedirect
  from django.shortcuts import get_object_or_404, render
  from django.urls import reverse
  from django.views import generic
  from django.utils import timezone
  
  from .models import Choice, Question
  
  # ...
  class IndexView(generic.ListView):
      template_name = 'polls/index.html'
      context_object_name = 'latest_question_list'
  
      def get_queryset(self):
          """
          Return the last five published questions (not including those set to be
          published in the future).
          """
          return Question.objects.filter(
              pub_date__lte=timezone.now()
          ).order_by('-pub_date')[:5]
  
  class DetailView(generic.DetailView):
      model = Question
      template_name = 'polls/detail.html'
      def get_queryset(self):
          """
          Excludes any questions that aren't published yet.
          """
          return Question.objects.filter(pub_date__lte=timezone.now())
  
  class ResultsView(generic.DetailView):
      model = Question
      template_name = 'polls/results.html'
  
  def vote(request, question_id):
      question = get_object_or_404(Question, pk=question_id)
      try:
          selected_choice = question.choice_set.get(pk=request.POST['choice'])
      except (KeyError, Choice.DoesNotExist):
          # Redisplay the question voting form.
          return render(request, 'polls/detail.html', {
              'question': question,
              'error_message': "You didn't select a choice.",
          })
      else:
          selected_choice.votes += 1
          selected_choice.save()
          # Always return an HttpResponseRedirect after successfully dealing
          # with POST data. This prevents data from being posted twice if a
          # user hits the Back button.
          return HttpResponseRedirect(reverse('polls:results', args=(question.id,)))
  </code></pre>
  
  <p>mysite/polls/urls.py</p>
  
  <pre><code>from django.urls import path
  
  from . import views
  
  app_name = 'polls'
  urlpatterns = [
      path('', views.IndexView.as_view(), name='index'),
      path('&lt;int:pk&gt;/', views.DetailView.as_view(), name='detail'),
      path('&lt;int:pk&gt;/results/', views.ResultsView.as_view(), name='results'),
      path('&lt;int:question_id&gt;/vote/', views.vote, name='vote'),
  ]
  </code></pre>
  
  <p>mysite/urls.py</p>
  
  <pre><code>from django.contrib import admin
  from django.urls import include, path
  
  urlpatterns = [
      path('polls/', include('polls.urls')),
      path('admin/', admin.site.urls),
  ]
  </code></pre>
  
  <p>mysite/polls/templates/polls/index.html</p>
  
  <pre><code>{% load static %}
  
  &lt;link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}" /&gt;
  
  {% if latest_question_list %}
      &lt;ul&gt;
      {% for question in latest_question_list %}
          &lt;li&gt;&lt;a href="{% url 'polls:detail' question.id %}/"&gt;{{ question.question_text }}&lt;/a&gt;&lt;/li&gt;
      {% endfor %}
      &lt;/ul&gt;
  {% else %}
      &lt;p&gt;No polls are available.&lt;/p&gt;
  {% endif %}
  </code></pre>
  
  <p>mysite/polls/templates/polls/detail.html</p>
  
  <pre><code>&lt;h1&gt;{{ question.question_text }}&lt;/h1&gt;
  
  {% if error_message %}&lt;p&gt;&lt;strong&gt;{{ error_message }}&lt;/strong&gt;&lt;/p&gt;{% endif %}
  
  &lt;form action="{% url 'polls:vote' question.id %}" method="post"&gt;
  {% csrf_token %}
  {% for choice in question.choice_set.all %}
      &lt;input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}" /&gt;
      &lt;label for="choice{{ forloop.counter }}"&gt;{{ choice.choice_text }}&lt;/label&gt;&lt;br /&gt;
  {% endfor %}
  &lt;input type="submit" value="Vote" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>mysite/polls/templates/polls/result.html</p>
  
  <pre><code>&lt;h1&gt;{{ question.question_text }}&lt;/h1&gt;
  
  &lt;ul&gt;
  {% for choice in question.choice_set.all %}
      &lt;li&gt;{{ choice.choice_text }} -- {{ choice.votes }} vote{{ choice.votes|pluralize }}&lt;/li&gt;
  {% endfor %}
  &lt;/ul&gt;
  
  &lt;a href="{% url 'polls:detail' question.id %}"&gt;Vote again?&lt;/a&gt;
  </code></pre>