I am trying to get my pyramid app to use pyramid_jinja2 and pyramid_webassets.
My main config function looks a little like this:
scrollTop
After going through the docs multiple times it seems to be configured correctly but I keep getting the error:
def main(global_config, **settings):
engine = engine_from_config(settings, 'sqlalchemy.', encoding='utf-8')
get_root = appmaker(engine)
session_factory = session_factory_from_settings(settings)
config = Configurator(settings=settings, root_factory=get_root)
config.include('pyramid_handlers')
config.include('pyramid_jinja2')
config.add_jinja2_renderer('.html')
config.add_jinja2_search_path('myapp:templates', name='.html')
config.include('pyramid_webassets')
config.add_jinja2_extension('webassets.ext.jinja2.AssetsExtension')
assets_env = config.get_webassets_env()
jinja2_env = config.get_jinja2_environment()
jinja2_env.assets_environment = assets_env
Not sure as to why jinja2_env.assets_environment = assets_env
AttributeError: 'NoneType' object has no attribute 'assets_environment'
is remaining undefined. The only dependency should be jinja2_env
which is definitely being used and set on the config object. Any insights or examples to configs with jinja2 and webassets would be much appreciated.
答案 0 :(得分:0)
这回答了我的问题 - https://github.com/Pylons/pyramid_jinja2/issues/111
需要Template.addPost.onRendered ->
@autorun (c) ->
# extract the name in a safe way
{name} = Meteor.user()?.profile
# once a name has been found, update the DOM and stop the autorun
if name
# note that name is an id so we don't need @$
$('#name').val name
c.stop()
。