reorder config imports for more specific overrides
This commit is contained in:
parent
5f5301e9c9
commit
ab009e4f59
@ -17,12 +17,11 @@ def create_app(instance_path=None, test_config=None):
|
|||||||
# if it doesn't already exist, create the instance folder
|
# if it doesn't already exist, create the instance folder
|
||||||
os.makedirs(app.instance_path, exist_ok=True)
|
os.makedirs(app.instance_path, exist_ok=True)
|
||||||
|
|
||||||
if test_config is None:
|
# load defaults from config provided with the application
|
||||||
# load defaults from config provided with the application
|
app.config.from_object('incorporealcms.config.Config')
|
||||||
app.config.from_object('incorporealcms.config.Config')
|
# load specific instance configurations
|
||||||
# load specific instance configurations
|
app.config.from_pyfile('config.py', silent=True)
|
||||||
app.config.from_pyfile('config.py', silent=True)
|
if test_config:
|
||||||
else:
|
|
||||||
app.config.from_mapping(test_config)
|
app.config.from_mapping(test_config)
|
||||||
|
|
||||||
dictConfig(app.config['LOGGING'])
|
dictConfig(app.config['LOGGING'])
|
||||||
|
2
setup.py
2
setup.py
@ -15,7 +15,7 @@ def extract_requires():
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='incorporeal-cms',
|
name='incorporeal-cms',
|
||||||
description='Flask project for running https://incorporeal.org.',
|
description='Flask project for running https://suou.net (and eventually others).',
|
||||||
url='https://git.incorporeal.org/bss/incorporeal-cms',
|
url='https://git.incorporeal.org/bss/incorporeal-cms',
|
||||||
license='GPL3',
|
license='GPL3',
|
||||||
author='Brian S. Stephan',
|
author='Brian S. Stephan',
|
||||||
|
13
tests/test_factory.py
Normal file
13
tests/test_factory.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
"""Test basic configuration stuff."""
|
||||||
|
import os
|
||||||
|
|
||||||
|
from incorporealcms import create_app
|
||||||
|
|
||||||
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
|
||||||
|
def test_config():
|
||||||
|
"""Test create_app without passing test config."""
|
||||||
|
instance_path = os.path.join(HERE, 'instance')
|
||||||
|
assert not create_app(instance_path=instance_path).testing
|
||||||
|
assert create_app(instance_path=instance_path, test_config={"TESTING": True}).testing
|
Loading…
Reference in New Issue
Block a user