我正在使用python django,我在运行tests.py时出错,这意味着什么:
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.发布于 2013-04-11 23:52:08
这意味着Django无法找到与特定路径名和参数匹配的路由,因此无法通过反向路由生成URL。
也许adingcomment是一个打字错误,而应该是addingcomment?
发布于 2013-04-11 23:52:43
reverse('adingcomment', kwargs={'post_id' : 1, 'content':'hjhgh'})找不到URL路由。
也许你注册了一个addingcomment路由?您需要检查路由的名称和提供的参数,以匹配您注册的现有路由。有关更多详细信息,请参阅Reverse resolution of URLs文档。
https://stackoverflow.com/questions/15953287
复制相似问题