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 trial

Python Django Basics Final Details Step Detail View

Ashish Yadav
Ashish Yadav
255 Points

While 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.

Michael King
Michael King
62 Points

Hi 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).

3 Answers

found 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
MOD
Chris Freeman
Treehouse Moderator 68,454 Points

What command are you using to start the server? Try:

$ python manage.py runserver
Ashish Yadav
Ashish Yadav
255 Points

yes i am using $ python manage.py runserver it successfully running but after that its showing

page not found(404)

Chris Freeman
Chris Freeman
Treehouse Moderator 68,454 Points

Do 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?

having 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
Cristian Romero
11,911 Points

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