summaryrefslogtreecommitdiff
path: root/lib/web.py
blob: dc9dc83f61a65f2432439c98743287a22300dd32 (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 x in lines]
        else:
            lista = []

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