Пример #1
0
    def build():
        posts = list(PostsModule.list_posts())
        for post in posts:
            tmpl_name = os.path.join(current_app.config['POSTS_TEMPLATE_DIR_NAME'], 'post.html')
            generated = Module.render(tmpl_name, post=post)
            with open(os.path.join(PostsModule.build_dest(), post.slug), 'w') as f:
                f.write(generated)

        tmpl_name = os.path.join(current_app.config['POSTS_TEMPLATE_DIR_NAME'], 'list.html')
        generated = Module.render(tmpl_name, posts=posts)
        with open(os.path.join(PostsModule.build_dest(), '_list.html'), 'w') as f:
            f.write(generated)
Пример #2
0
 def build():
     generated = Module.render('base.html')
     with open(os.path.join(AdminModule.build_dest(), 'index.html'), 'w') as f:
         f.write(generated)
Пример #3
0
def build():
    for mod in Module._registered_module_func():
        mod.build()
    return jsonify({'status': 'OK'})