禁用debugtoolbar会导致Mako错误

时间:2014-02-06 11:25:03

标签: python pyramid mako pyramid-debug-toolbar

我的一个Pyramid应用程序在我的settings.ini文件包含:

时完全正常
pyramid.includes =
    pyramid_debugtoolbar
    pyramid_tm

但如果我把事情改为:

pyramid.includes =
    pyramid_tm

发生这种情况:

Traceback (most recent call last):
  File "/home/pharm/big_data/local/lib/python2.7/site-packages/waitress-0.8.8-py2.7.egg/waitress/channel.py", line 337, in service
    task.service()
  File "/home/pharm/big_data/local/lib/python2.7/site-packages/waitress-0.8.8-py2.7.egg/waitress/task.py", line 173, in service
    self.execute()
  File "/home/pharm/big_data/local/lib/python2.7/site-packages/waitress-0.8.8-py2.7.egg/waitress/task.py", line 392, in execute
    app_iter = self.channel.server.application(env, start_response)
  File "/home/pharm/big_data/local/lib/python2.7/site-packages/pyramid-1.5a4-py2.7.egg/pyramid/router.py", line 272, in __call__
    response = self.invoke_subrequest(request, use_tweens=True)
  File "/home/pharm/big_data/local/lib/python2.7/site-packages/pyramid-1.5a4-py2.7.egg/pyramid/router.py", line 247, in invoke_subrequest
    response = handle_request(request)
  File "/home/pharm/big_data/local/lib/python2.7/site-packages/pyramid_fanstatic-0.5-py2.7.egg/pyramid_fanstatic/__init__.py", line 64, in __call__
    response = self.handler(request)
  File "/home/pharm/big_data/local/lib/python2.7/site-packages/pyramid-1.5a4-py2.7.egg/pyramid/tweens.py", line 21, in excview_tween
    response = handler(request)
  File "/home/pharm/big_data/local/lib/python2.7/site-packages/pyramid_tm-0.7-py2.7.egg/pyramid_tm/__init__.py", line 82, in tm_tween
    reraise(*exc_info)
  File "/home/pharm/big_data/local/lib/python2.7/site-packages/pyramid_tm-0.7-py2.7.egg/pyramid_tm/__init__.py", line 63, in tm_tween
    response = handler(request)
  File "/home/pharm/big_data/local/lib/python2.7/site-packages/pyramid-1.5a4-py2.7.egg/pyramid/router.py", line 163, in handle_request
    response = view_callable(context, request)
  File "/home/pharm/big_data/local/lib/python2.7/site-packages/pyramid-1.5a4-py2.7.egg/pyramid/config/views.py", line 377, in rendered_view
    context)
  File "/home/pharm/big_data/local/lib/python2.7/site-packages/pyramid-1.5a4-py2.7.egg/pyramid/renderers.py", line 416, in render_view
    return self.render_to_response(response, system, request=request)
  File "/home/pharm/big_data/local/lib/python2.7/site-packages/pyramid-1.5a4-py2.7.egg/pyramid/renderers.py", line 439, in render_to_response
    result = self.render(value, system_values, request=request)
  File "/home/pharm/big_data/local/lib/python2.7/site-packages/pyramid-1.5a4-py2.7.egg/pyramid/renderers.py", line 419, in render
    renderer = self.renderer
  File "/home/pharm/big_data/local/lib/python2.7/site-packages/pyramid-1.5a4-py2.7.egg/pyramid/decorator.py", line 37, in __get__
    val = self.wrapped(inst)
  File "/home/pharm/big_data/local/lib/python2.7/site-packages/pyramid-1.5a4-py2.7.egg/pyramid/renderers.py", line 402, in renderer
    'No such renderer factory %s' % str(self.type))
ValueError: No such renderer factory .mak

我很想知道原因。

用来解释:

问题是为什么会发生这种情况,而不是如何解决它...在项目中使用mako并且一切正常。仅当我禁用debugtoolbar时才会发生该错误。所以debugtoolbar以某种方式使mako可用于应用程序?怎么样?

1 个答案:

答案 0 :(得分:1)

问题是

ValueError: No such renderer factory .mak

金字塔默认不再依赖或配置Mako和Chameleon模板系统渲染器。

  

对Mako模板的支持已经转移到名为pyramid_mako的附加软件包中,对Chameleon模板的支持已经移动到名为pyramid_chameleon的附加软件包中。这些软件包是对这些模板语言的旧内置支持的直接替代品。您所要做的就是安装它们并在配置中激活它们以注册.pt和/或.mako(或.mak)的渲染器工厂,以使您的应用程序再次工作。

你可以在这里阅读更多相关信息 - > Major Backwards Incompatibilities