app module¶
- get_connection()[source]¶
Open a SQLite connection using the database path from config.toml.
Reads
db_filefrom the[settings]section ofconfig.toml. Falls back to'headlines.db'if the config cannot be loaded.- Returns:
A two-element tuple containing:
An open database connection with
row_factoryset tosqlite3.Rowfor dict-style column access.The resolved database file path as a string.
- Return type:
- index()[source]¶
Render the main headlines page.
Queries all headlines joined with their parent feed, groups them by feed title in Python, and passes the grouped structure to the
index.htmltemplate.- Returns:
Rendered HTML response for the
/route.- Return type:
- feeds()[source]¶
Render the feeds page listing all RSS sources with headline counts.
Queries all feeds with a count of their associated headlines using a LEFT JOIN so feeds with zero articles still appear.
- Returns:
Rendered HTML response for the
/feedsroute.- Return type:
- runs()[source]¶
Render the run history page showing the last 50 aggregator runs.
- Returns:
Rendered HTML response for the
/runsroute.- Return type:
- trigger_run()[source]¶
Fire the aggregator in a background thread and return immediately.
Uses
_run_lockto ensure only one run can be in progress at a time. The frontend polls/statusto detect completion. This route is used by the Jinja2 frontend — the API equivalent lives at/api/v1/run.