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 url Tag

Kaushal Patel
Kaushal Patel
250 Points

Reverse for 'step' with arguments '()' and keyword arguments '{u'course_pk': 1, u'step_pk': ''}' not found

As per the video presentation, when editied course_detail.html with below lines and tried to access below link. Getting this error:

    <h3>
        <a href="{% url 'step' course_pk=step.course.pk step_pk=step_pk %}">{{ step.title }}</a>
    </h3>

http://10.32.12.14:8000/courses/1/

NoReverseMatch at /courses/1/ Reverse for 'step' with arguments '()' and keyword arguments '{u'course_pk': 1, u'step_pk': ''}' not found. 1 pattern(s) tried: ['courses/(?P<course_pk>\d+)/(?P<step_pk>\d+)/$'] Request Method: GET Request URL: http://10.32.12.14:8000/courses/1/ Django Version: 1.9.13 Exception Type: NoReverseMatch Exception Value:
Reverse for 'step' with arguments '()' and keyword arguments '{u'course_pk': 1, u'step_pk': ''}' not found. 1 pattern(s) tried: ['courses/(?P<course_pk>\d+)/(?P<step_pk>\d+)/$'] Exception Location: /usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py in _reverse_with_prefix, line 508 Python Executable: /usr/bin/python Python Version: 2.7.6 Python Path:
['/root/Django/learning_site', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']

1 Answer

Haydar Al-Rikabi
Haydar Al-Rikabi
5,971 Points

Can you please show us your app's urls.py, views.py as well as the full template code!!