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

BRIAN WEBER
BRIAN WEBER
21,570 Points

Step_pk different for Python Basics Course (3 and 4 instead of 1 and 2) Why?

In the following video, when accessing the first step of the of the first course (Python Basics) using this url http://port-8000-hz7t9z6j4h.treehouse-app.com/courses/1/1/ I do not get the first step of the first course. Instead my course_list.html page renders.

When I change the 1 to a 2 for the step_pk, I get a 404 error. The "What's the deal with strings?" step shows up on a step_pk of 3 and the "Using the shell" step shows up on a step_pk of 4. Can someone explain to me why this is not working with 1 and 2? Does it have to do with how my urls are orders in urls.py? Or the time at which I created these steps under the first course?

Any help would be appreciated!

Thank you,

Brian

1 Answer

Peter Lawless
Peter Lawless
24,404 Points

No, I don't think it's the urls. Workspaces are not working for me tonight so I can't really troubleshoot this but I would speculate that somewhere along the way the first two instances of "step" which would have had primary keys 1 and 2, respectively, were deleted and re-entered, taking up primary keys 3 and 4. That would explain the 404 because the object you are requesting does not exist.

BRIAN WEBER
BRIAN WEBER
21,570 Points

Hi Peter,

Thanks for the reply. I do agree with you that the first two instances of "step" which would have had primary keys 1 and 2 were deleted and re-entered as primary keys 3 and 4 as I opened and closed the workspace multiple times during the Django Basics course. I think a good way to fix this problem would be to use slugs in the urls so the url is based on the course.title and step.title values respectively.