Skip to main content
 首页 » 编程设计

python之ValueError : No such renderer factory . mak之Python Pyramid 错误

2025年05月04日7TianFang

我升级到 Python 1.4.5,当我尝试在这里运行我的项目时出现错误:

ValueError: No such renderer factory .mak 
[Applications/MAMP/htdocs/WhoAt/env/www/www/views/index/index.py line:32] 
get() 
     ->return self.render(mak) 
 
[Applications/MAMP/htdocs/WhoAt/env/www/www/views/__init__.py line:231] 
render() 
     ->response = render_to_response(template, context, request=self.request) 
 
[Applications/MAMP/htdocs/WhoAt/env/lib/python2.7/site-packages/pyramid/renderers.py line:138] 
render_to_response() 
     ->return helper.render_to_response(value, None, request=request) 
 
ValueError: No such renderer factory .mak 

我昨天查了一下,了解到默认情况下不再支持 mako 模板。并且必须将它们添加回:What's New In Pyramid 1.5

我按照该文档页面上的步骤操作,但仍然收到错误 :(

在init.py

config.include('pyramid_mako') # < added that 
config.add_static_view('static', 'static', cache_max_age=3600) 
config.scan() 
return config.make_wsgi_app() 

并在 setup.py 中添加了“pyramid_mako”和变色龙

requires = [ 
    'pyramid', 
    'pyramid_mako', 
    'pyramid_chameleon', 
    'pyramid_debugtoolbar', 
    'waitress', 
] 

还在终端中运行 setup.py :(

有没有其他人在修复 PyCharm 中的 mako 模板时遇到问题?

我的 pip freeze 的打印列表:http://codepen.io/leongaban/pen/Bvakw/

请您参考如下方法:

必须重新创建我的 VirtualEnv 并重新开始。能够修复丢失的 mak 问题

在这里回答 What version of Pyramid do I have and what's the best way to update?通过 @madjar