crunk-columns is a PESOS style website maker
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.2 KiB

1 year ago
from flask import (
render_template,
redirect,
)
import tomli
from parse_rss_feeds import parse_rss_feeds
from app import create_app
from column import Column
APP = create_app()
@APP.route("/singlefeed")
def singlefeed():
with open("columns.toml", "rb") as f:
feeds_dict = tomli.load(f)
feeds = feeds_dict["column"]
feed = parse_rss_feeds(feeds[0]["urls"][0])
return render_template("singlefeed.html", feed=feed)
@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:
entries = parse_rss_feeds(column_from_file["urls"])
title = column_from_file["title"]
column = Column(title=title, entries=entries)
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"])
columns.append(column)
return render_template("index.html", columns=columns)
if __name__ == "__main__":
APP.debug = True
APP.run(port=5000)