eklipse

solar eclipse search engine
Log | Files | Refs | README | LICENSE

commit 8f1bac110e28dd3f1f3e8c070a6406e11e7d286c
parent 5fde9e97b59b4bc5ccff365cf22ea48ab58533f4
Author: tin <ichtinnotl@gmail.com>
Date:   Fri,  7 Dec 2018 22:45:58 +0100

now loads config from object and envvar

Diffstat:
config.py | 9---------
eklipse/__init__.py | 8+++++---
eklipse/default_config.py | 9+++++++++
3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/config.py b/config.py @@ -1,9 +0,0 @@ -DEBUG = False -SQLALCHEMY_ECHO = False - -import os - -basedir = os.path.abspath(os.path.dirname(__file__)) - -DATABASE_URL = 'sqlite:///' + \ -os.path.join(basedir, 'eklipse/database/database.sqlite') diff --git a/eklipse/__init__.py b/eklipse/__init__.py @@ -5,10 +5,12 @@ from werkzeug.exceptions import InternalServerError, BadRequest from eklipse.utils.json_serializer import AlchemyEncoder from .models import SolarEclipse -app = Flask(__name__, instance_relative_config=True, static_url_path='/static') +app = Flask(__name__, static_url_path='/static') +) + +app.config.from_object('eklipse.default_config') +app.config.from_envvar('EKLIPSE_CONFIG') -app.config.from_object('config') -app.config.from_pyfile('config.py') app.json_encoder = AlchemyEncoder from sqlalchemy import create_engine diff --git a/eklipse/default_config.py b/eklipse/default_config.py @@ -0,0 +1,9 @@ +DEBUG = False +SQLALCHEMY_ECHO = False + +import os + +basedir = os.path.abspath(os.path.dirname(__file__)) + +DATABASE_URL = 'sqlite:///' + \ +os.path.join(basedir, 'eklipse/database/database.sqlite')