Flask directory listing dirtree.html <!doctype html>
<title>Path: {{ tree.name }}</title>-
{%- for item in tree.children recursive %}
- {{ item.name }}
{%- if item.children -%}
- {{ loop(item.children) }}
{%- endfor %}
import os from flask import Flask, render_template
app = Flask(name)
@app.route('/') def dirtree(): path = os.path.expanduser(u'~') return render_template('dirtree.html', tree=make_tree(path))
if name=="main": app.run(host='localhost', port=8888, debug=True)