#!/usr/bin/python3 # vim: shiftwidth=4 tabstop=4 expandtab import configparser import waitress from flask import Flask app = Flask(__name__) @app.route("/", methods=["GET"]) def index(): return app.send_static_file("index.html") def load_config(): """Load ./config.ini File and read web-template Section""" retval = {} config = configparser.ConfigParser() config.read("config.ini") for option in config.options("web-template"): retval[option] = config.get("web-template", option) return retval # dictionary with all options from web-template section if __name__ == '__main__': config = load_config() waitress.serve(app, listen="{}:{}".format(config["address"], config["port"])) # production server / bind to port #serve(app, unix_socket='/run/web-template/unix.sock') # production server / unix domain socket #app.run() # debug server - NOT FOR PRODUCTION!