Add configparser

This commit is contained in:
sqozz 2021-03-24 16:02:57 +01:00
parent 26bb615553
commit 90a5b9b628
2 changed files with 8 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.png *.png
*.ttf *.ttf
config.ini

View File

@ -3,6 +3,7 @@ from bottle import route, run, static_file, template
from os import listdir from os import listdir
from os.path import join as pathjoin from os.path import join as pathjoin
from random import random, choice from random import random, choice
import configparser
# echo -n "["; ls | xargs -I{} echo -n \"{}\",; echo "]" # echo -n "["; ls | xargs -I{} echo -n \"{}\",; echo "]"
BG_IMAGES = listdir("./static/img/background") BG_IMAGES = listdir("./static/img/background")
@ -41,4 +42,10 @@ def random_bg_image():
def callback(path): def callback(path):
return static_file(path, root="static") return static_file(path, root="static")
def parseConfig():
config = configparser.ConfigParser()
config.read("config.ini")
return config
CONFIG = parseConfig()
run(host="localhost", port=8080) run(host="localhost", port=8080)