20 lines
511 B
Python
20 lines
511 B
Python
from flask import Flask
|
|
from flask import render_template
|
|
app = Flask(__name__)
|
|
|
|
todo_file = "/home/adam/Sync/todo/todo.txt"
|
|
num_lines = 5
|
|
|
|
@app.route("/")
|
|
def index():
|
|
with open(todo_file) as f:
|
|
lines = [i for i in f.read().splitlines() if not i == ""]
|
|
lines.sort()
|
|
todo = lines[:num_lines]
|
|
hw = [i for i in lines if "+hw" in i][:num_lines]
|
|
print(hw)
|
|
return render_template('index.html', todo = todo, hw = hw)
|
|
|
|
if __name__ == "__main__":
|
|
app.run(debug=True, host='0.0.0.0')
|