diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2021-02-02 12:24:06 +0000 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2021-02-02 12:24:06 +0000 |
commit | 1dac1ee189bdcf70a5dd933d5f6a69a15d5a8d7e (patch) | |
tree | 0bff6312d7e3bcc364d7632da708f74d15cbd0f3 /app.py | |
parent | 6eb416ac7784ce08b6959e3db06ccd404736516f (diff) | |
download | boymoder.blog-1dac1ee189bdcf70a5dd933d5f6a69a15d5a8d7e.tar.gz boymoder.blog-1dac1ee189bdcf70a5dd933d5f6a69a15d5a8d7e.zip |
added the program files for the first time
Diffstat (limited to 'app.py')
-rw-r--r-- | app.py | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -0,0 +1,35 @@ +import configparser +import database +import flask + +app = flask.Flask(__name__) +CONFIG = configparser.ConfigParser() +CONFIG.read("edaweb.conf") + +def get_template_items(title, db): + return { + "links": db.get_header_links(), + "image": db.get_image("telegrampic"), + "title": title, + "articles": db.get_header_articles() + } + +@app.route("/") +def index(): + with database.Database() as db: + return flask.render_template( + "index.html", + **get_template_items("edaweb.co.uk", db) + ) + +@app.route("/discord") +def discord(): + with database.Database() as db: + return flask.render_template( + "discord.html", + **get_template_items("Discord", db), + discord = CONFIG["discord"]["username"] + ) + +if __name__ == "__main__": + app.run(host = "0.0.0.0", debug = True) |