brain off, produce boilerplate

This commit is contained in:
crunk 2023-10-02 21:09:50 +02:00
parent 04c15f0628
commit 4cf0e2fac2
3 changed files with 20 additions and 3 deletions

19
app.py
View File

@ -20,9 +20,11 @@ def create_app():
db.init_app(APP)
migrate.init_app(APP, db, render_as_batch=True)
create_rss_feed()
@scheduler.task("interval", id="update", minutes=10)
def update():
create_rss_feed()
update_rss_feed()
return APP
@ -30,7 +32,18 @@ def create_app():
def create_rss_feed():
print("creating rss feed")
fg = FeedGenerator()
fg.id("http://crunk.website")
fg.title("Crunk website")
fg.author({"name": "John Doe", "email": "john@example.de"})
fg.link(href="http://crunk.website", rel="alternate")
fg.subtitle("Some things crunk is doing!")
fg.link(href="http://crunk.website/test.atom", rel="self")
fg.language("en")
atomfeed = fg.atom_str(pretty=True)
rssfeed = fg.rss_str(pretty=True)
fg.atom_file("atom.xml")
fg.rss_file("rss.xml")
fg.atom_file("static/atom.xml")
fg.rss_file("static/rss.xml")
def update_rss_feed():
print("updating rss feed")

2
static/atom.xml Normal file
View File

@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><id>http://crunk.website</id><title>Crunk website</title><updated>2023-10-02T19:08:59.272412+00:00</updated><author><name>John Doe</name><email>john@example.de</email></author><link href="http://crunk.website" rel="alternate"/><link href="http://crunk.website/test.atom" rel="self"/><generator uri="https://lkiesow.github.io/python-feedgen" version="0.9.0">python-feedgen</generator><subtitle>Some things crunk is doing!</subtitle></feed>

2
static/rss.xml Normal file
View File

@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"><channel><title>Crunk website</title><link>http://crunk.website/test.atom</link><description>Some things crunk is doing!</description><atom:link href="http://crunk.website/test.atom" rel="self"/><docs>http://www.rssboard.org/rss-specification</docs><generator>python-feedgen</generator><language>en</language><lastBuildDate>Mon, 02 Oct 2023 19:08:59 +0000</lastBuildDate></channel></rss>