Compare commits
2 Commits
2c9ce79130
...
75d118e740
Author | SHA1 | Date |
---|---|---|
Stefan Friese | 75d118e740 | |
Stefan Friese | acb9aa213d |
|
@ -1,3 +1,4 @@
|
||||||
__pycache__/
|
__pycache__/
|
||||||
templates/blog/*
|
templates/blog/*
|
||||||
flask_run.sh
|
flask_run.sh
|
||||||
|
poetry.lock
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?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>Website of Stefan Friese</title><link>https://stefan.works</link><description>test</description><atom:link href="https://stefan.works" rel="self"/><docs>http://www.rssboard.org/rss-specification</docs><generator>python-feedgen</generator><language>en-us</language><lastBuildDate>Mon, 30 May 2022 22:18:56 +0000</lastBuildDate><item><title>The Joy of One-Liners</title><link>https://stefan.works/blog/The Joy of One-Liners/index.html</link><guid isPermaLink="false">https://stefan.works/blog/The Joy of One-Liners/index.html</guid><pubDate>Sun, 29 May 2022 22:52:44 +0200</pubDate></item><item><title>Keep It Simple</title><link>https://stefan.works/blog/Keep It Simple/index.html</link><guid isPermaLink="false">https://stefan.works/blog/Keep It Simple/index.html</guid><pubDate>Tue, 01 Jun 2021 22:47:04 +0200</pubDate></item></channel></rss>
|
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"><channel><title>Website of Stefan Friese</title><link>https://stefan.works</link><description>test</description><atom:link href="https://stefan.works" rel="self"/><docs>http://www.rssboard.org/rss-specification</docs><generator>python-feedgen</generator><language>en-us</language><lastBuildDate>Tue, 20 Jun 2023 19:21:25 +0000</lastBuildDate><item><title>The Joy of One-Liners</title><link>https://stefan.works/blog/The Joy of One-Liners/index.html</link><guid isPermaLink="false">https://stefan.works/blog/The Joy of One-Liners/index.html</guid><pubDate>Sun, 29 May 2022 22:27:49 +0200</pubDate></item><item><title>Keep It Simple</title><link>https://stefan.works/blog/Keep It Simple/index.html</link><guid isPermaLink="false">https://stefan.works/blog/Keep It Simple/index.html</guid><pubDate>Tue, 01 Jun 2021 18:57:19 +0200</pubDate></item></channel></rss>
|
|
@ -1,2 +1,2 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?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>Website of Stefan Friese</title><link>https://stefan.works</link><description>test</description><atom:link href="https://stefan.works" rel="self"/><docs>http://www.rssboard.org/rss-specification</docs><generator>python-feedgen</generator><language>en-us</language><lastBuildDate>Sun, 29 May 2022 21:08:39 +0000</lastBuildDate><item><title>The Joy of One-Liners</title><link>https://stefan.works/blog/The Joy of One-Liners/index.html</link><guid isPermaLink="false">https://stefan.works/blog/The Joy of One-Liners/index.html</guid><pubDate>Sun, 29 May 2022 22:52:44 +0200</pubDate></item><item><title>Keep It Simple</title><link>https://stefan.works/blog/Keep It Simple/index.html</link><guid isPermaLink="false">https://stefan.works/blog/Keep It Simple/index.html</guid><pubDate>Tue, 01 Jun 2021 22:47:04 +0200</pubDate></item></channel></rss>
|
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"><channel><title>Website of Stefan Friese</title><link>https://stefan.works</link><description>test</description><atom:link href="https://stefan.works" rel="self"/><docs>http://www.rssboard.org/rss-specification</docs><generator>python-feedgen</generator><language>en-us</language><lastBuildDate>Tue, 20 Jun 2023 19:11:26 +0000</lastBuildDate><item><title>The Joy of One-Liners</title><link>https://stefan.works/blog/The Joy of One-Liners/index.html</link><guid isPermaLink="false">https://stefan.works/blog/The Joy of One-Liners/index.html</guid><pubDate>Sun, 07 Aug 2022 22:27:46 +0200</pubDate></item><item><title>Keep It Simple</title><link>https://stefan.works/blog/Keep It Simple/index.html</link><guid isPermaLink="false">https://stefan.works/blog/Keep It Simple/index.html</guid><pubDate>Sun, 30 Jan 2022 17:57:19 +0100</pubDate></item></channel></rss>
|
|
@ -7,7 +7,7 @@ p { font-size: 16px; }
|
||||||
blockquote { text-align: center; font-size: 16px; font-style: normal; line-height: 30px;}
|
blockquote { text-align: center; font-size: 16px; font-style: normal; line-height: 30px;}
|
||||||
pre { background-color: #eee;color: #2f3337;border: 1px solid #ddd; font-size: 14px; padding-left: 2ch; line-height: 18px; overflow: auto; }
|
pre { background-color: #eee;color: #2f3337;border: 1px solid #ddd; font-size: 14px; padding-left: 2ch; line-height: 18px; overflow: auto; }
|
||||||
code { background-color: #eee;color: #2f3337; }
|
code { background-color: #eee;color: #2f3337; }
|
||||||
hr { height: 0px; }
|
hr { height: 1px; background: #333; border: 0px;}
|
||||||
a {color: inherit; text-decoration: solid underline;}
|
a {color: inherit; text-decoration: solid underline;}
|
||||||
a:hover {color: red;}
|
a:hover {color: red;}
|
||||||
img { max-width: 100%; }
|
img { max-width: 100%; }
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
[tool.poetry]
|
||||||
|
name = "website"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Stefan's Blog"
|
||||||
|
authors = ["stefan <mail@stefan.works>"]
|
||||||
|
readme = "README.md"
|
||||||
|
|
||||||
|
[tool.poetry.dependencies]
|
||||||
|
python = "^3.11"
|
||||||
|
Flask = "^2.3.2"
|
||||||
|
feedgen = "^0.9.0"
|
||||||
|
Frozen-Flask = "^0.18"
|
||||||
|
pytz = "^2023.3"
|
||||||
|
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["poetry-core"]
|
||||||
|
build-backend = "poetry.core.masonry.api"
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
export FLASK_DEBUG=True
|
||||||
|
export FLASK_APP=start_site.py
|
||||||
|
|
||||||
|
python3 -m flask run
|
|
@ -14,23 +14,34 @@ meta_data = {root[len("./templates/blog/"):] :
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index(_paths=meta_data):
|
def index(_paths=meta_data):
|
||||||
|
''' Main Site.
|
||||||
|
'''
|
||||||
sorted_meta_data = dict(sorted(meta_data.items(), reverse=True, key=lambda item : item[1]))
|
sorted_meta_data = dict(sorted(meta_data.items(), reverse=True, key=lambda item : item[1]))
|
||||||
return render_template("index.html", _paths=sorted_meta_data)
|
return render_template("index.html", _paths=sorted_meta_data)
|
||||||
|
|
||||||
@app.route('/blog/<blog_item>/index.html')
|
@app.route('/blog/<blog_item>/index.html')
|
||||||
def blog(blog_item, _date=meta_data):
|
def blog(blog_item, _date=meta_data):
|
||||||
|
''' Blog Pages.
|
||||||
|
'''
|
||||||
return render_template(f"blog/{blog_item}/index.html", _date=meta_data[blog_item])
|
return render_template(f"blog/{blog_item}/index.html", _date=meta_data[blog_item])
|
||||||
|
|
||||||
@app.route("/about.html")
|
@app.route("/about.html")
|
||||||
def about():
|
def about():
|
||||||
|
''' About Page.
|
||||||
|
'''
|
||||||
return render_template("about.html")
|
return render_template("about.html")
|
||||||
|
|
||||||
@app.route("/contact.html")
|
@app.route("/contact.html")
|
||||||
def contact():
|
def contact():
|
||||||
|
''' Contact Page.
|
||||||
|
'''
|
||||||
return render_template("contact.html")
|
return render_template("contact.html")
|
||||||
|
|
||||||
@app.route("/rss.xml")
|
@app.route("/rss.xml")
|
||||||
def rss(_items=meta_data):
|
def rss(_items=meta_data):
|
||||||
|
''' RSS Feed.
|
||||||
|
Generates RSS feed as XML
|
||||||
|
'''
|
||||||
#rss_feed = []
|
#rss_feed = []
|
||||||
_tz = pytz.timezone('Europe/Berlin')
|
_tz = pytz.timezone('Europe/Berlin')
|
||||||
_fg = FeedGenerator()
|
_fg = FeedGenerator()
|
||||||
|
@ -53,18 +64,29 @@ def rss(_items=meta_data):
|
||||||
|
|
||||||
@app.route('/favicon.ico')
|
@app.route('/favicon.ico')
|
||||||
def favicon():
|
def favicon():
|
||||||
|
''' Provides favicon.
|
||||||
|
'''
|
||||||
return send_from_directory(os.path.join(app.root_path, 'static'), 'favicon.ico')
|
return send_from_directory(os.path.join(app.root_path, 'static'), 'favicon.ico')
|
||||||
|
|
||||||
@app.errorhandler(404)
|
@app.errorhandler(404)
|
||||||
def page_not_found(_error):
|
def page_not_found(_error):
|
||||||
|
''' Error Handling.
|
||||||
|
Error 404
|
||||||
|
'''
|
||||||
return render_template("/status_code/404.html"), 404
|
return render_template("/status_code/404.html"), 404
|
||||||
|
|
||||||
@app.errorhandler(400)
|
@app.errorhandler(400)
|
||||||
def bad_request(_error):
|
def bad_request(_error):
|
||||||
|
''' Error Handling.
|
||||||
|
Error 400
|
||||||
|
'''
|
||||||
return render_template("/status_code/400.html"), 400
|
return render_template("/status_code/400.html"), 400
|
||||||
|
|
||||||
@app.errorhandler(500)
|
@app.errorhandler(500)
|
||||||
def internal_server_error(_error):
|
def internal_server_error(_error):
|
||||||
|
''' Error Handling.
|
||||||
|
Error 500
|
||||||
|
'''
|
||||||
return render_template("/status_code/500.html"), 500
|
return render_template("/status_code/500.html"), 500
|
||||||
|
|
||||||
with app.test_request_context():
|
with app.test_request_context():
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?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>Website of Stefan Friese</title><link>https://stefan.works</link><description>test</description><atom:link href="https://stefan.works" rel="self"/><docs>http://www.rssboard.org/rss-specification</docs><generator>python-feedgen</generator><language>en-us</language><lastBuildDate>Mon, 30 May 2022 22:18:56 +0000</lastBuildDate><item><title>The Joy of One-Liners</title><link>https://stefan.works/blog/The Joy of One-Liners/index.html</link><guid isPermaLink="false">https://stefan.works/blog/The Joy of One-Liners/index.html</guid><pubDate>Sun, 29 May 2022 22:52:44 +0200</pubDate></item><item><title>Keep It Simple</title><link>https://stefan.works/blog/Keep It Simple/index.html</link><guid isPermaLink="false">https://stefan.works/blog/Keep It Simple/index.html</guid><pubDate>Tue, 01 Jun 2021 22:47:04 +0200</pubDate></item></channel></rss>
|
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"><channel><title>Website of Stefan Friese</title><link>https://stefan.works</link><description>test</description><atom:link href="https://stefan.works" rel="self"/><docs>http://www.rssboard.org/rss-specification</docs><generator>python-feedgen</generator><language>en-us</language><lastBuildDate>Tue, 20 Jun 2023 19:21:25 +0000</lastBuildDate><item><title>The Joy of One-Liners</title><link>https://stefan.works/blog/The Joy of One-Liners/index.html</link><guid isPermaLink="false">https://stefan.works/blog/The Joy of One-Liners/index.html</guid><pubDate>Sun, 29 May 2022 22:27:49 +0200</pubDate></item><item><title>Keep It Simple</title><link>https://stefan.works/blog/Keep It Simple/index.html</link><guid isPermaLink="false">https://stefan.works/blog/Keep It Simple/index.html</guid><pubDate>Tue, 01 Jun 2021 18:57:19 +0200</pubDate></item></channel></rss>
|
|
@ -7,7 +7,7 @@ p { font-size: 16px; }
|
||||||
blockquote { text-align: center; font-size: 16px; font-style: normal; line-height: 30px;}
|
blockquote { text-align: center; font-size: 16px; font-style: normal; line-height: 30px;}
|
||||||
pre { background-color: #eee;color: #2f3337;border: 1px solid #ddd; font-size: 14px; padding-left: 2ch; line-height: 18px; overflow: auto; }
|
pre { background-color: #eee;color: #2f3337;border: 1px solid #ddd; font-size: 14px; padding-left: 2ch; line-height: 18px; overflow: auto; }
|
||||||
code { background-color: #eee;color: #2f3337; }
|
code { background-color: #eee;color: #2f3337; }
|
||||||
hr { height: 0px; }
|
hr { height: 1px; background: #333; border: 0px;}
|
||||||
a {color: inherit; text-decoration: solid underline;}
|
a {color: inherit; text-decoration: solid underline;}
|
||||||
a:hover {color: red;}
|
a:hover {color: red;}
|
||||||
img { max-width: 100%; }
|
img { max-width: 100%; }
|
||||||
|
|
Loading…
Reference in New Issue