Hala Kamal
Hala Kamal

Reputation: 21

NoReverseMatch error when running tests in Django

i'm using python django i had error while running the tests.py what does that mean :

Traceback (most recent call last):
  File "/home/hala/Desktop/lasting/sharesoft-13/project/tager/tager_www/tests.py", line 82, in test_saving_comments
    response=c.get(reverse('adingcomment', kwargs={'post_id' : 1, 'content':'hjhgh'}))
  File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 496, in reverse
    return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
  File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 416, in _reverse_with_prefix
    "arguments '%s' not found." % (lookup_view_s, args, kwargs))
NoReverseMatch: Reverse for 'adingcomment' with arguments '()' and keyword arguments '{'content': 'hjhgh', 'post_id': 1}' not found.

Upvotes: 2

Views: 1154

Answers (2)

Martijn Pieters
Martijn Pieters

Reputation: 1121166

The reverse('adingcomment', kwargs={'post_id' : 1, 'content':'hjhgh'}) failed to find a URL route.

Perhaps you registered a addingcomment route instead? You need to check the name of the route and the provided arguments to match an existing route you registered. For more details see the Reverse resolution of URLs documentation.

Upvotes: 0

Amber
Amber

Reputation: 526473

It means that Django was unable to find a route which would match that particular path name and arguments, and thus was unable to generate a URL by reversing the route.

Perhaps adingcomment was a typo, and should have been addingcomment instead?

Upvotes: 1

Related Questions