From 90a5b9b62893c8024b24584dd4eddd648e159e26 Mon Sep 17 00:00:00 2001 From: sqozz Date: Wed, 24 Mar 2021 16:02:57 +0100 Subject: [PATCH] Add configparser --- .gitignore | 1 + homepage/main.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index e56c987..c6186a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.png *.ttf +config.ini diff --git a/homepage/main.py b/homepage/main.py index 814131e..d539434 100644 --- a/homepage/main.py +++ b/homepage/main.py @@ -3,6 +3,7 @@ from bottle import route, run, static_file, template from os import listdir from os.path import join as pathjoin from random import random, choice +import configparser # echo -n "["; ls | xargs -I{} echo -n \"{}\",; echo "]" BG_IMAGES = listdir("./static/img/background") @@ -41,4 +42,10 @@ def random_bg_image(): def callback(path): return static_file(path, root="static") +def parseConfig(): + config = configparser.ConfigParser() + config.read("config.ini") + return config + +CONFIG = parseConfig() run(host="localhost", port=8080)