Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAshish Yadav
255 PointsWhile running in http://127.0.0.1:8000/courses/1/1/ Page not found (404)
i checked all the code. i missing something out here
help me out on this. i am not getting any clue.
3 Answers
Anna Muravyeva
12,162 Pointsfound it, the slash needed to be on the other side of the closing tag
path('<int:course_pk>/<int:step_pk>/', views.step_detail, name='step-detail'),
Chris Freeman
Treehouse Moderator 68,454 PointsWhat command are you using to start the server? Try:
$ python manage.py runserver
Ashish Yadav
255 Pointsyes i am using $ python manage.py runserver it successfully running but after that its showing
page not found(404)
Chris Freeman
Treehouse Moderator 68,454 PointsDo you get anything at the root URL:
http://127.0.0.1:8000/
Or
http://127.0.0.1:8000/courses/
If so then it's a routing issue in urls.py
Can you post your urls.py
file?
Anna Muravyeva
12,162 Pointshaving the same problem, the urls for courses show up, but course steps details throw a 404 error
urlpatterns = [
path('', views.course_list, name="course_list"),
path('<int:course_pk>/<int:step_pk/>', views.step_detail, name='step-detail'),
path('<int:pk>/', views.course_detail, name='course-detail'),
]
Cristian Romero
11,911 PointsHi Anna, Its a minor error at the end of your code lines
Replace name='course-detail' for name='course_detail'
This is my code:
urlpatterns = [ path('', views.course_list, name='course_list'), path('<int:course_pk>/<int:step_pk>/', views.step_detail, name='step_detail_with_pk'), path('<int:pk>/', views.course_detail, name='course_detail_with_pk'), ]
Michael King
62 PointsMichael King
62 PointsHi Ashish, Do you have a web server running locally? If not, you can easily setup a local web server using an extension for google chrome (https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb?utm_source=chrome-app-launcher-info-dialog).