From b74c6a87b99e6912b8561ea642efacabc5314d3c Mon Sep 17 00:00:00 2001 From: fram3d Date: Thu, 18 Jan 2024 14:32:53 +0100 Subject: [PATCH] add config.ini and save db during upgrade --- flaskapp/config.ini | 2 ++ flaskapp/routes.py | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 flaskapp/config.ini diff --git a/flaskapp/config.ini b/flaskapp/config.ini new file mode 100644 index 0000000..9685910 --- /dev/null +++ b/flaskapp/config.ini @@ -0,0 +1,2 @@ +[sectionname] +CONFIGVARIABLE = testvalue diff --git a/flaskapp/routes.py b/flaskapp/routes.py index 30eefb5..17f6c38 100644 --- a/flaskapp/routes.py +++ b/flaskapp/routes.py @@ -2,6 +2,14 @@ from flask import render_template, request, redirect from flaskapp import app, db from flaskapp.functions import * from flaskapp.models import * +import configparser + +CONFIG_PATH = "/var/flaskapp/flaskapp/config.ini" + +config = configparser.ConfigParser() +config.read(CONFIG_PATH) + +CONFIGVARIABLE = config.get('sectionname', 'CONFIGVARIABLE') @app.route('/', methods=['GET']) def index():