作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在关注 2012 年的视频 - Gevent-socketio,跨框架实时网络直播演示 ( https://www.youtube.com/watch?v=zhh_N5pmHBY )
我正在使用 Ubuntu 15.04。
8 分钟后,在 init.py 中,他更正了 config.add_renderer('.html', 'pyramid.mako_templatating.renderer_factory')
但之后我仍然可以无法让它发挥作用。我收到的错误如下。
任何和所有的帮助将不胜感激。
谢谢
(env)cloud@cloudnetwork:~/Code/python/3/moo/Moo$ pserve --reload development.ini
Starting subprocess with file monitor
Traceback (most recent call last):
File "/home/cloud/Code/python/3/moo/env/bin/pserve", line 9, in <module>
load_entry_point('pyramid==1.5.7', 'console_scripts', 'pserve')()
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 58, in main
return command.run()
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 328, in run
global_conf=vars)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 363, in loadapp
return loadapp(app_spec, name=name, relative_to=relative_to, **kw)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
return loadobj(APP, uri, name=name, **kw)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
return context.create()
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
return self.object_type.invoke(self)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
return fix_call(context.object, context.global_conf, **context.local_conf)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/util.py", line 55, in fix_call
val = callable(*args, **kw)
File "/home/cloud/Code/python/3/moo/Moo/moo/__init__.py", line 10, in main
config.add_renderer('.html', 'pyramid.mako_templating.renderer_factory')
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/util.py", line 528, in wrapper
result = wrapped(self, *arg, **kw)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/config/rendering.py", line 33, in add_renderer
factory = self.maybe_dotted(factory)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/config/__init__.py", line 825, in maybe_dotted
return self.name_resolver.maybe_resolve(dotted)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/path.py", line 320, in maybe_resolve
return self._resolve(dotted, package)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/path.py", line 327, in _resolve
return self._zope_dottedname_style(dotted, package)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/path.py", line 382, in _zope_dottedname_style
__import__(used)
ImportError: No module named mako_templating
最佳答案
注册新扩展以在 Pyramid 中处理为 Mako 模板的最简单方法如下:
config.include('pyramid_mako')
config.add_mako_renderer('.html')
这将正确设置渲染器。
<小时/>Mako 模板已从 Pyramid 核心框架中删除,因此 pyramid.mako_templated.*
不再存在。
关于python - Gevent - 导入错误 : No module named mako_templating,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33109762/
我正在关注 2012 年的视频 - Gevent-socketio,跨框架实时网络直播演示 ( https://www.youtube.com/watch?v=zhh_N5pmHBY ) 我正在使用
我是一名优秀的程序员,十分优秀!