#33249: Writing your first Django app, part 3, Initial Path missing '/'
-----------------------------------------+-------------------------------
               Reporter:  Eric Jonathan  |          Owner:  nobody
                   Type:  Bug            |         Status:  new
              Component:  Documentation  |        Version:  3.2
               Severity:  Normal         |       Keywords:  example error
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  1
                  UI/UX:  0              |
-----------------------------------------+-------------------------------
 O/S: Windows 10
 Python Version 3.10.0
 Django 3.2.8

 Following the tutorial at the "Writing your first Django app, part 3"
 (https://docs.djangoproject.com/en/3.2/intro/tutorial03/),
 at the:
   poll/urls.py
 example, currently, it's


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

 With error:
 Page not found (404)
 Request Method: GET
 Request URL:    http://localhost:8000/polls/6/
 Using the URLconf defined in mysite.urls, Django tried these URL patterns,
 in this order:

 polls [name='index']
 polls <int:question_id>/ [name='detail']
 polls <int:question_id>/results/ [name='results']
 polls <int:question_id>/vote/ [name='vote']
 admin/
 The current path, polls/6/, 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.

 It should be:

 {{{
 urlpatterns = [
     path('', views.index, name='index'),
     path('/<int:question_id>/', views.detail, name='detail'),
     path('/<int:question_id>/results/', views.results, name='results'),
     path('/<int:question_id>/vote/', views.vote, name='vote'),
 ]
 }}}

 With result:

 You're looking at question 6.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33249>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/056.8dbf0c89c319cf5fea987f7ddd364728%40djangoproject.com.

Reply via email to