原来Django错误:是 Caught NoReverseMatch while rendering的问题,作为参考!
TemplateSyntaxError at /admin2/index/
Caught NoReverseMatch while rendering: Reverse for 'admin2_msg_new' with arguments '()' and keyword arguments '{}' not found.
Request Method: GET
Request URL: http:
www.csvt.net/
Django Version: 1.3.1
Exception Type: TemplateSyntaxError
Exception Value:
Caught NoReverseMatch while rendering: Reverse for 'admin2_msg_new' with arguments '()' and keyword arguments '{}' not found.
Exception Location: /usr/lib/python2.6/site-packages/django/template/defaulttags.py in render, line 450
Python Executable: /usr/bin/python
Python Version: 2.6.6
Python Path:
['/var/www/html',
'/usr/lib/python2.6/site-packages/tornado-2.3-py2.6.egg',
'/usr/lib/python2.6/site-packages/Trac-0.12.3-py2.6.egg',
'/usr/lib/python2.6/site-packages/Genshi-0.6-py2.6.egg',
'/usr/lib64/python26.zip',
'/usr/lib64/python2.6',
'/usr/lib64/python2.6/plat-linux2',
'/usr/lib64/python2.6/lib-tk',
'/usr/lib64/python2.6/lib-old',
'/usr/lib64/python2.6/lib-dynload',
'/usr/lib64/python2.6/site-packages',
'/usr/lib64/python2.6/site-packages/PIL',
'/usr/lib64/python2.6/site-packages/gst-0.10',
'/usr/lib64/python2.6/site-packages/gtk-2.0',
'/usr/lib64/python2.6/site-packages/webkit-1.0',
'/usr/lib/python2.6/site-packages',
'/usr/lib/python2.6/site-packages']
Server time: 星期三, 19 九月 2012 09:46:28 +0800
Template error
sever tinme
In template /var/www/html/propyindex/appadmin2/templates/admin2-index.html, error at line 5
Caught NoReverseMatch while rendering: Reverse for 'admin2_msg_new' with arguments '()' and keyword arguments '{}' not found.
1 <h1> PyIndex 管理员平台 </h1>
2 <hr />
3 <h4>
4 welcome root! |
5 <a href='{% url admin2_msg_new %}' id='id1'> 新消息(3) </a> |
6 <a href='{% url admin2_msg_add %}' id='id2'> 发布消息 </a> |
7 <a href='{% url admin2_msg_his %}' id='id3'> 历史消息 </a> |
8 <a href='{% url admin2_rep_cnt %}' id='id4'> 版本库统计</a> |
9 <a href='{% url admin2_rep_ans %}' id='id5'> 配额管理 </a> |
10 <a href='{% url admin2_rep_qts %}' id='id6'> 仓库分析 </a> |
11 <a href='{% url admin2_ans_usr %}' id='id7'> 用户分析 </a> |
12 <a href='{% url admin2_ans_grp %}' id='id8'> 分组分析 </a> |
13 <a href='{% url admin2_mon_eth %}' id='id9'> 流量监控 </a> |
14 <a href='{% url admin2_mon_pat %}' id='ida'> 分区监控 </a> |
15 <a href='{% url admin2_mon_hit %}' id='ida'> 攻击监控 </a> |
Traceback Switch to copy-and-paste view
复制代码
那么这个错误, 主要是你制定了URL路径参数的原因, 如果你没有制定, 那么可能的选项是你把URL中 $ 写成了 %.
如果对于指定了路径参数, 需要你给标签赋值, 例如:'{% url admin2_msg_new ‘param1' %}'