from flask import Flask
import mustache

app = Flask(__name__)


@mustache.template("templates/tree.mustache")
def file_tree():
    return {'files':
            [dict(type='dir', name='this', url='/tree/this'),
             dict(type='file', name='that',  url='/tree/that'),
             dict(type='file', name='the-other',  url='/tree/the-other'),
             ]}, {}


@app.route("/")
@mustache.template('templates/main.mustache')
def index():
    context = {'title': 'index', 'content': file_tree()}
    return context, {}

if __name__ == '__main__':
    app.run(debug=True)
