|
|
|
@ -11,6 +11,13 @@ from vasl_templates.webapp.config.constants import APP_NAME, BASE_DIR |
|
|
|
|
|
|
|
|
|
# --------------------------------------------------------------------- |
|
|
|
|
|
|
|
|
|
def load_debug_config( fname ): |
|
|
|
|
"""Configure the application.""" |
|
|
|
|
config_parser.read( fname ) |
|
|
|
|
app.config.update( dict( config_parser.items( "Debug" ) ) ) |
|
|
|
|
|
|
|
|
|
# --------------------------------------------------------------------- |
|
|
|
|
|
|
|
|
|
# initialize Flask |
|
|
|
|
app = Flask( __name__ ) |
|
|
|
|
|
|
|
|
@ -20,16 +27,17 @@ config_parser = configparser.ConfigParser() |
|
|
|
|
config_parser.optionxform = str # preserve case for the keys :-/ |
|
|
|
|
config_parser.read( os.path.join( config_dir, "app.cfg" ) ) |
|
|
|
|
app.config.update( dict( config_parser.items( "System" ) ) ) |
|
|
|
|
fname = os.path.join( config_dir, "debug.cfg" ) |
|
|
|
|
if os.path.isfile( fname ) : |
|
|
|
|
config_parser.read( fname ) |
|
|
|
|
app.config.update( dict( config_parser.items( "Debug" ) ) ) |
|
|
|
|
|
|
|
|
|
# load any debug configuration |
|
|
|
|
_fname = os.path.join( config_dir, "debug.cfg" ) |
|
|
|
|
if os.path.isfile( _fname ) : |
|
|
|
|
load_debug_config( _fname ) |
|
|
|
|
|
|
|
|
|
# initialize logging |
|
|
|
|
fname = os.path.join( config_dir, "logging.cfg" ) |
|
|
|
|
if os.path.isfile( fname ): |
|
|
|
|
_fname = os.path.join( config_dir, "logging.cfg" ) |
|
|
|
|
if os.path.isfile( _fname ): |
|
|
|
|
import logging.config |
|
|
|
|
logging.config.dictConfig( json.load( open(fname,"r") ) ) |
|
|
|
|
logging.config.dictConfig( json.load( open(_fname,"r") ) ) |
|
|
|
|
|
|
|
|
|
# load the application |
|
|
|
|
import vasl_templates.webapp.main #pylint: disable=cyclic-import |
|
|
|
|