Django 使用re_path 发生错误

淮南草 2019-04-16 05:24:46
无法正常显示页面

现象:
错误:
nid: 2
--- Logging error ---
--- Logging error ---
--- Logging error ---
--- Logging error ---
--- Logging error ---
--- Logging error ---
--- Logging error ---
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 51605)
nid: 2
--- Logging error ---
--- Logging error ---
--- Logging error ---
Unhandled exception in thread started by <bound method Thread._bootstrap of <Thread(Thread-3, started daemon 2500)>>
Traceback (most recent call last):
File "D:\F\Anaconda3\lib\site-packages\django\core\handlers\exception.py", line 35, in inner
response = get_response(request)
File "D:\F\Anaconda3\lib\site-packages\django\core\handlers\base.py", line 128, in _get_response
response = self.process_exception_by_middleware(e, request)
File "D:\F\Anaconda3\lib\site-packages\django\core\handlers\base.py", line 126, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "D:\F\eclipse-workspace\day19_2\app01\views.py", line 25, in index
File "D:\F\Anaconda3\lib\site-packages\django\shortcuts.py", line 36, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "D:\F\Anaconda3\lib\site-packages\django\template\loader.py", line 62, in render_to_string
return template.render(context, request)
File "D:\F\Anaconda3\lib\site-packages\django\template\backends\django.py", line 61, in render
return self.template.render(context)
File "D:\F\Anaconda3\lib\site-packages\django\template\base.py", line 175, in render
return self._render(context)
File "D:\F\Anaconda3\lib\site-packages\django\template\base.py", line 167, in _render
return self.nodelist.render(context)
File "D:\F\Anaconda3\lib\site-packages\django\template\base.py", line 943, in render
bit = node.render_annotated(context)
File "D:\F\Anaconda3\lib\site-packages\django\template\base.py", line 910, in render_annotated
return self.render(context)
File "D:\F\Anaconda3\lib\site-packages\django\template\defaulttags.py", line 447, in render
url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
File "D:\F\Anaconda3\lib\site-packages\django\urls\base.py", line 90, in reverse
return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
File "D:\F\Anaconda3\lib\site-packages\django\urls\resolvers.py", line 636, in _reverse_with_prefix
raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'indexx' with no arguments not found. 1 pattern(s) tried: ['demo/(\\d+)/']

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

源码:
urls.py

views.py

index.html

...全文
422 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
淮南草 2019-04-18
  • 打赏
  • 举报
回复
还是不行,
郑光辉 2019-04-17
  • 打赏
  • 举报
回复
path是2.0以后的新路由函数用法 demo/<int:nid>/

37,743

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • WuKongSecurity@BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧