首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TemplateSyntaxError在/accounts/登录/

TemplateSyntaxError在/accounts/登录/
EN

Stack Overflow用户
提问于 2015-04-04 11:27:16
回答 1查看 1.2K关注 0票数 0

我试图使用这里提供的示例构建一个简单的django论坛:http://lightbird.net/dbe/forum1.html

当我试图打开本地主机/论坛/

代码语言:javascript
复制
TemplateSyntaxError at /accounts/login/
Could not parse the remainder: ':index' from 'admin:index'

Error during template rendering

In template /Documents/Projects/dbe/forum/templates/forum/fbase.html, error at line 52

Could not parse the remainder: ':index' from 'admin:index'
42  
43  <body>
44      <div id="sidebar"> {% block sidebar %} {% endblock %} </div>
45      <div id="container">
46          <div id="menu">
47              {% block nav-global %}
48  
49                  <!-- MENU -->
50                  <h3><a href="{% url forum.views.main %}">ForumApp</a></h3>
51  
52                  {% if user.is_staff %} <a href="{% url admin:index %}">Admin</a> {% endif %}
53                  {% if user.is_authenticated %}
54                      <a href="{% url forum.views.profile user.pk %}">Edit profile</a> {% endif %}
55  
56                  {% if not user.is_authenticated %}<a href="/accounts/login/?next=/forum/">login</a> | <a
57                      href="/accounts/register/">register</a>{% endif %}
58  
59                  {% if user.is_authenticated %}<a href="/accounts/logout/?next=/forum/">logout</a>
60                      {% endif %}
61  
62              {% endblock %}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-04-04 11:37:15

试着把引号放在网址上。变化

代码语言:javascript
复制
"{% url admin:index %}"

代码语言:javascript
复制
"{% url 'admin:index' %}"
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29445843

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档