NoReverseMatch error when following Django Tutorial

2,582 views
Skip to first unread message

Jerry Wu

unread,
Jun 22, 2014, 4:53:12 AM6/22/14
to django...@googlegroups.com
Dear every one,

I am new to Python and Django and am following the Tutorial to start my first site. But I am getting an error of NoReverseMatch error when vote. It should be redirected but error below happened.

NoReverseMatch at /polls/1/vote/

Reverse for ' results' with arguments '(1,)' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Request Method:POST
Request URL:http://localhost:8000/polls/1/vote/
Django Version:1.6.5
Exception Type:NoReverseMatch
Exception Value:
Reverse for ' results' with arguments '(1,)' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Exception Location:/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/urlresolvers.py in _reverse_with_prefix, line 452
Python Executable:/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Python Version:2.7.6
Python Path:
['/Users/wctjerry/Dropbox/code/django/mysite',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages',
 '/Library/Python/2.7/site-packages']
Server time:Sun, 22 Jun 2014 08:38:56 +0000



I am sure I finished namespace part in the end of Tutorial Part 3. And I checked code in Tutorial Part 4  again and again, seeming all the same. Here is my code, could any one give me some thoughts?

Thanks.


Noxxan

unread,
Jun 22, 2014, 7:54:41 AM6/22/14
to django...@googlegroups.com
Hi
It looks like you have in polls/views.py whitespace in reverse function ("polls: results"), try without it ('polls:results").

Jerry Wu

unread,
Jun 22, 2014, 8:00:09 AM6/22/14
to django...@googlegroups.com
It works!  Thank you very much!
Reply all
Reply to author
Forward
0 new messages