【发布时间】:2011-12-11 09:27:18
【问题描述】:
我是 TurboGears 的新手,刚刚在虚拟环境中安装了 TG2 开发。我正在关注quickstart guide,并通过
成功构建了一个helloworldpaster quickstart
我启动了服务器并将网络浏览器导航到 localhost:8080
您不知道吗,我立即收到一个错误,而不是文档建议我应该看到的欢迎消息。
错误显示:
AttributeError: 'AcceptLanguage' object has no attribute 'best_matches'
这是踪迹:
URL: http://localhost:8080/
File 'C:\\VirtualEnv_1\\lib\\site-packages\\weberror-0.10.3-py2.7.egg\\weberror\\evalexception.py', line 431 in respond
app_iter = self.application(environ, detect_start_response)
File 'C:\\VirtualEnv_1\\lib\\site-packages\\beaker-1.6-py2.7.egg\\beaker\\middleware.py', line 73 in __call__
return self.app(environ, start_response)
File 'C:\\VirtualEnv_1\\lib\\site-packages\\beaker-1.6-py2.7.egg\\beaker\\middleware.py', line 155 in __call__
return self.wrap_app(environ, session_start_response)
File 'C:\\VirtualEnv_1\\lib\\site-packages\\routes-1.12.3-py2.7.egg\\routes\\middleware.py', line 131 in __call__
response = self.app(environ, start_response)
File 'C:\\VirtualEnv_1\\lib\\site-packages\\pylons-1.0-py2.7.egg\\pylons\\wsgiapp.py', line 107 in __call__
response = self.dispatch(controller, environ, start_response)
File 'C:\\VirtualEnv_1\\lib\\site-packages\\pylons-1.0-py2.7.egg\\pylons\\wsgiapp.py', line 312 in dispatch
return controller(environ, start_response)
File 'C:\\VirtualEnv_1\\Scripts\\HelloWorld\\helloworld\\lib\\base.py', line 27 in __call__
return TGController.__call__(self, environ, start_response)
File 'C:\\VirtualEnv_1\\lib\\site-packages\\pylons-1.0-py2.7.egg\\pylons\\controllers\\core.py', line 211 in __call__
response = self._dispatch_call()
File 'C:\\VirtualEnv_1\\lib\\site-packages\\pylons-1.0-py2.7.egg\\pylons\\controllers\\core.py', line 162 in _dispatch_call
response = self._inspect_call(func)
File 'C:\\VirtualEnv_1\\lib\\site-packages\\pylons-1.0-py2.7.egg\\pylons\\controllers\\core.py', line 105 in _inspect_call
result = self._perform_call(func, args)
File 'C:\\VirtualEnv_1\\lib\\site-packages\\turbogears2-2.1.3-py2.7.egg\\tg\\controllers\\dispatcher.py', line 230 in _perform_call
setup_i18n()
File 'C:\\VirtualEnv_1\\lib\\site-packages\\turbogears2-2.1.3-py2.7.egg\\tg\\i18n.py', line 61 in setup_i18n
pylons.request.accept_language.best_matches())) AttributeError: 'AcceptLanguage' 对象没有属性 'best_matches'
是我安装时搞砸了,还是 TurboGears 有问题?
编辑:我创建了第二个项目,我命名为 GoodnightMoon,这次没有 Mako 模板选项(这是设置之间的唯一区别),我得到了同样的错误:
'AcceptLanguage' object has no attribute 'best_matches'
不幸的是,这个问题是我能找到的唯一一个与此错误完全相关的web search。
我可以使用任何其他线索并提供给 stackoverflow 来帮助回答这个问题吗?
按照 Michael Pederson 以下的建议,我研究了 i18n。我有一个 i18n 目录,其中只有一个子目录,名为 ru(我假设是俄语)。我正在使用英语默认的系统和浏览器。
在提出这个问题时,我使用的是最新的 TG2 发行版,v. 2.1.3 和 tg.devtools 2.1.x
【问题讨论】:
-
老实说,这听起来像是 i18n 的问题。您浏览器的默认语言是什么?您使用的是哪个版本的 TurboGears?您能否提供指向您正在关注的确切教程的链接?一些较旧的可能会为您提供有关最新版本 TG 的错误说明。
-
对我来说也一样:有什么答案吗?
标签: python pylons turbogears2