我是靠谱客的博主 缥缈电话,最近开发中收集的这篇文章主要介绍django.urls.exceptions.NoReverseMatch: Reverse for ‘login‘ not found.,觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
Internal Server Error: /article/article-list/
Traceback (most recent call last):
File "D:Codesdjango_projectenvlibsite-packagesdjangocorehandlersexception.py", line 34, in inner
response = get_response(request)
File "D:Codesdjango_projectenvlibsite-packagesdjangocorehandlersbase.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "D:Codesdjango_projectenvlibsite-packagesdjangocorehandlersbase.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "D:Codesdjango_projectenvmy_blogarticleviews.py", line 18, in article_list
return render(request,'article/list.html',context)
File "D:Codesdjango_projectenvlibsite-packagesdjangoshortcuts.py", line 36, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplateloader.py", line 62, in render_to_string
return template.render(context, request)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplatebackendsdjango.py", line 61, in render
return self.template.render(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplatebase.py", line 171, in render
return self._render(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplatebase.py", line 163, in _render
return self.nodelist.render(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplatebase.py", line 937, in render
bit = node.render_annotated(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplatebase.py", line 904, in render_annotated
return self.render(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplateloader_tags.py", line 150, in render
return compiled_parent._render(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplatebase.py", line 163, in _render
return self.nodelist.render(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplatebase.py", line 937, in render
bit = node.render_annotated(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplatebase.py", line 904, in render_annotated
return self.render(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplateloader_tags.py", line 188, in render
return template.render(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplatebase.py", line 173, in render
return self._render(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplatebase.py", line 163, in _render
return self.nodelist.render(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplatebase.py", line 937, in render
bit = node.render_annotated(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplatebase.py", line 904, in render_annotated
return self.render(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplatedefaulttags.py", line 309, in render
return nodelist.render(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplatebase.py", line 937, in render
bit = node.render_annotated(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplatebase.py", line 904, in render_annotated
return self.render(context)
File "D:Codesdjango_projectenvlibsite-packagesdjangotemplatedefaulttags.py", line 443, in render
url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
File "D:Codesdjango_projectenvlibsite-packagesdjangourlsbase.py", line 90, in reverse
return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
File "D:Codesdjango_projectenvlibsite-packagesdjangourlsresolvers.py", line 660, in _reverse_with_prefix
raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'login' not found. 'login' is not a valid view function or pattern name.
django中的url反转出错,其实就是userprofile中的app_name ='userprofile'在article中也出现 了一次。这个代码错误我找了1周了,要细心。
最后
以上就是缥缈电话为你收集整理的django.urls.exceptions.NoReverseMatch: Reverse for ‘login‘ not found.的全部内容,希望文章能够帮你解决django.urls.exceptions.NoReverseMatch: Reverse for ‘login‘ not found.所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复