pecha.red/app.py

25 lines
630 B
Python
Raw Permalink Normal View History

2020-04-13 17:23:52 +00:00
from flask import Flask, render_template, json
from flask_misaka import markdown
2020-04-12 08:20:44 +00:00
2020-04-13 17:23:52 +00:00
import glob
2020-04-12 08:20:44 +00:00
2020-04-13 17:23:52 +00:00
app = Flask(__name__)
2020-04-12 09:37:27 +00:00
contact_data = json.load(open("data/contact.json"))
2020-04-13 17:23:52 +00:00
writings = []
for filename in glob.iglob("writings/**/*.md", recursive = True):
# TODO: split into parent dir and filename
writings.append(filename)
2020-04-12 09:37:27 +00:00
2020-04-12 08:20:44 +00:00
@app.route("/")
def render_home():
2020-04-12 09:03:02 +00:00
return render_template("home.html", big_header = True)
@app.route("/contact")
def render_contact():
2020-04-12 09:37:27 +00:00
return render_template("contact.html", data = contact_data)
2020-04-13 17:23:52 +00:00
@app.route("/writings")
def render_writings():
return render_template("writings.html", writings = writings)