From c5226fd683632e49f900367a688b43a3494d26c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Tue, 24 Apr 2018 17:03:39 +0200 Subject: [PATCH] Load configuration from file --- .gitignore | 1 + backend/app.py | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 90f4cd8..54b8c1b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ quotes.db +settings.cfg diff --git a/backend/app.py b/backend/app.py index 385b9c4..fb1dfc6 100644 --- a/backend/app.py +++ b/backend/app.py @@ -1,5 +1,3 @@ -import os - import flask import flask_cors import flask_login @@ -11,11 +9,8 @@ import itsdangerous import sqlalchemy -DB_PATH = os.path.expandvars('$HOME/quotes/quotes.db') - app = flask.Flask(__name__) -app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{DB_PATH}' -app.config['ERROR_404_HELP'] = False +app.config.from_envvar('SETTINGS') db = flask_sqlalchemy.SQLAlchemy(app) db.create_all()