2023-06-03 18:12:55 +02:00
|
|
|
from flask import (
|
|
|
|
render_template,
|
|
|
|
)
|
|
|
|
import tomli
|
|
|
|
|
|
|
|
from app import create_app
|
|
|
|
from column import Column
|
|
|
|
|
|
|
|
APP = create_app()
|
|
|
|
|
|
|
|
|
|
|
|
@APP.route("/")
|
|
|
|
def index():
|
|
|
|
with open("columns.toml", "rb") as f:
|
|
|
|
column_dict = tomli.load(f)
|
|
|
|
columns_file = column_dict["column"]
|
|
|
|
columns = []
|
|
|
|
for column_from_file in columns_file:
|
2023-06-03 19:27:41 +02:00
|
|
|
urls = column_from_file["urls"]
|
2023-06-03 18:12:55 +02:00
|
|
|
title = column_from_file["title"]
|
2023-06-03 19:27:41 +02:00
|
|
|
column = Column(title=title, urls=urls)
|
|
|
|
|
2023-06-03 18:12:55 +02:00
|
|
|
if "limit" in column_from_file:
|
|
|
|
column.set_limit(column_from_file["limit"])
|
|
|
|
if "sort_order" in column_from_file:
|
|
|
|
column.set_sort_order(column_from_file["sort_order"])
|
2023-06-03 19:27:41 +02:00
|
|
|
|
|
|
|
column.load_content_from_feeds()
|
2023-06-03 18:12:55 +02:00
|
|
|
columns.append(column)
|
|
|
|
return render_template("index.html", columns=columns)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
APP.debug = True
|
|
|
|
APP.run(port=5000)
|