summaryrefslogtreecommitdiff
path: root/lib/web.py
blob: ca8e10fc8adf12c1658e3b6e77f24d4c6e777cbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from flask import Flask, render_template
from .config import config

app = Flask(__name__)

@app.route("/")
def hello():
    with open(config['path'], 'rb') as fout:
        try:
            lines = fout.readlines()
        except Exception as e:
            lines = ''

        if lines is not None:
            lista = [x.strip() for i, x in enumerate(lines) if i > 0]
        else:
            lista = []

    try:
        return render_template("index.html", list_todo = lista, len_todo = len(lista))
    except Exception as e:
        return 'errore: %s' % e