Python 如何解析TemplateSyntaxError:无法解析余数错误?

Python 如何解析TemplateSyntaxError:无法解析余数错误?,python,django,python-2.7,templates,django-models,Python,Django,Python 2.7,Templates,Django Models,我得到了一个“TemplateSyntaxError:无法解析其余部分:”此处:https://docs.djangoproject.com/en/1.7/intro/tutorial05/ >>> response = client.get(reverse('polls:index')) 给我这个: Traceback (most recent call last): File "<console>", line 1, in <module>

我得到了一个
“TemplateSyntaxError:无法解析其余部分:”
此处:
https://docs.djangoproject.com/en/1.7/intro/tutorial05/

>>> response = client.get(reverse('polls:index'))
给我这个:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/django/test/client.py", line 470, in get
    **extra)
  File "/Library/Python/2.7/site-packages/django/test/client.py", line 286, in get
    return self.generic('GET', path, secure=secure, **r)
  File "/Library/Python/2.7/site-packages/django/test/client.py", line 358, in generic
    return self.request(**r)
  File "/Library/Python/2.7/site-packages/django/test/client.py", line 440, in request
    six.reraise(*exc_info)
  File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 137, in get_response
    response = response.render()
  File "/Library/Python/2.7/site-packages/django/template/response.py", line 103, in render
    self.content = self.rendered_content
  File "/Library/Python/2.7/site-packages/django/template/response.py", line 78, in rendered_content
    template = self.resolve_template(self.template_name)
  File "/Library/Python/2.7/site-packages/django/template/response.py", line 54, in resolve_template
    return loader.select_template(template)
  File "/Library/Python/2.7/site-packages/django/template/loader.py", line 188, in select_template
    return get_template(template_name, dirs)
  File "/Library/Python/2.7/site-packages/django/template/loader.py", line 144, in get_template
    template, origin = find_template(template_name, dirs)
  File "/Library/Python/2.7/site-packages/django/template/loader.py", line 132, in find_template
    source, display_name = loader(name, dirs)
  File "/Library/Python/2.7/site-packages/django/template/loader.py", line 44, in __call__
    return self.load_template(template_name, template_dirs)
  File "/Library/Python/2.7/site-packages/django/template/loader.py", line 50, in load_template
    template = get_template_from_string(source, origin, template_name)
  File "/Library/Python/2.7/site-packages/django/template/loader.py", line 156, in get_template_from_string
    return Template(source, origin, name)
  File "/Library/Python/2.7/site-packages/django/template/base.py", line 132, in __init__
    self.nodelist = compile_string(template_string, origin)
  File "/Library/Python/2.7/site-packages/django/template/base.py", line 162, in compile_string
    return parser.parse()
  File "/Library/Python/2.7/site-packages/django/template/base.py", line 290, in parse
    compiled_result = compile_func(self, token)
  File "/Library/Python/2.7/site-packages/django/template/defaulttags.py", line 975, in do_if
    nodelist = parser.parse(('elif', 'else', 'endif'))
  File "/Library/Python/2.7/site-packages/django/template/base.py", line 290, in parse
    compiled_result = compile_func(self, token)
  File "/Library/Python/2.7/site-packages/django/template/defaulttags.py", line 833, in do_for
    nodelist_loop = parser.parse(('empty', 'endfor',))
  File "/Library/Python/2.7/site-packages/django/template/base.py", line 290, in parse
    compiled_result = compile_func(self, token)
  File "/Library/Python/2.7/site-packages/django/template/defaulttags.py", line 1345, in url
    viewname = parser.compile_filter(bits[1])
  File "/Library/Python/2.7/site-packages/django/template/base.py", line 372, in compile_filter
    return FilterExpression(token, self)
  File "/Library/Python/2.7/site-packages/django/template/base.py", line 588, in __init__
    "from '%s'" % (token[upto:], token))
TemplateSyntaxError: Could not parse the remainder: '\u2018polls:detail\u2019' from '\u2018polls:detail\u2019'
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
get中的文件“/Library/Python/2.7/site packages/django/test/client.py”,第470行
**额外费用)
get中第286行的文件“/Library/Python/2.7/site packages/django/test/client.py”
返回self.generic('GET',path,secure=secure,**r)
文件“/Library/Python/2.7/site packages/django/test/client.py”,第358行,通用格式
返回自我请求(**r)
文件“/Library/Python/2.7/site packages/django/test/client.py”,第440行,在请求中
六、重放(*exc_信息)
文件“/Library/Python/2.7/site packages/django/core/handlers/base.py”,第137行,在get_响应中
response=response.render()
文件“/Library/Python/2.7/site packages/django/template/response.py”,第103行,呈现
self.content=自渲染内容
文件“/Library/Python/2.7/site packages/django/template/response.py”,第78行,在呈现的内容中
模板=self.resolve\u模板(self.template\u名称)
文件“/Library/Python/2.7/site packages/django/template/response.py”,第54行,在resolve_模板中
返回加载器。选择_模板(模板)
文件“/Library/Python/2.7/site packages/django/template/loader.py”,第188行,在select_模板中
返回获取模板(模板名称,目录)
文件“/Library/Python/2.7/site packages/django/template/loader.py”,第144行,在get_模板中
模板,原点=查找模板(模板名称,目录)
文件“/Library/Python/2.7/site packages/django/template/loader.py”,第132行,在find_模板中
源,显示\u名称=加载程序(名称,目录)
文件“/Library/Python/2.7/site packages/django/template/loader.py”,第44行,在__
返回self.load\u模板(模板名称、模板目录)
文件“/Library/Python/2.7/site packages/django/template/loader.py”,第50行,在load_模板中
模板=从字符串(源、源、模板名称)获取模板
文件“/Library/Python/2.7/site packages/django/template/loader.py”,第156行,从字符串获取模板
返回模板(来源、来源、名称)
文件“/Library/Python/2.7/site packages/django/template/base.py”,第132行,在__
self.nodelist=编译字符串(模板字符串,原点)
文件“/Library/Python/2.7/site packages/django/template/base.py”,第162行,编译字符串
返回parser.parse()
文件“/Library/Python/2.7/site packages/django/template/base.py”,第290行,在parse中
编译结果=编译函数(self,token)
文件“/Library/Python/2.7/site packages/django/template/defaulttags.py”,第975行,在do_if中
nodelist=parser.parse(('elif','else','endif'))
文件“/Library/Python/2.7/site packages/django/template/base.py”,第290行,在parse中
编译结果=编译函数(self,token)
文件“/Library/Python/2.7/site packages/django/template/defaulttags.py”,第833行,在do_中
nodelist_loop=parser.parse(('empty','endfor',))
文件“/Library/Python/2.7/site packages/django/template/base.py”,第290行,在parse中
编译结果=编译函数(self,token)
url中第1345行的文件“/Library/Python/2.7/site packages/django/template/defaulttags.py”
viewname=parser.compile\u过滤器(位[1])
文件“/Library/Python/2.7/site packages/django/template/base.py”,第372行,在编译过滤器中
返回筛选器表达式(令牌、自身)
文件“/Library/Python/2.7/site packages/django/template/base.py”,第588行,在__
“从'%s'”(令牌[最多:],令牌))
TemplateSyntaxError:无法分析“\u2018polls:detail\u2019”中的其余部分:“\u2018polls:detail\u2019”
如何解决此问题?

引用视图名称时使用的和字符;应该使用单引号或双引号的位置

使用
“轮询:详细信息”或
“轮询:详细信息”