Add an application config for local mode but hosted data.
This commit is contained in:
parent
540815b943
commit
fb91fb98da
2 changed files with 18 additions and 4 deletions
14
app.py
14
app.py
|
@ -5,13 +5,19 @@ from flask import Flask
|
|||
from flask.ext.principal import Principal
|
||||
from flask.ext.login import LoginManager
|
||||
from flask.ext.mail import Mail
|
||||
from config import ProductionConfig, DebugConfig
|
||||
from config import ProductionConfig, DebugConfig, LocalHostedConfig
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
is_prod = os.environ.get('STACK', '').strip().lower().startswith('prod')
|
||||
config_object = ProductionConfig() if is_prod else DebugConfig()
|
||||
app.config.from_object(config_object)
|
||||
stack = os.environ.get('STACK', '').strip().lower()
|
||||
if stack.startswith('prod'):
|
||||
config = ProductionConfig()
|
||||
elif stack.startswith('localhosted'):
|
||||
config = LocalHostedConfig()
|
||||
else:
|
||||
config = DebugConfig()
|
||||
|
||||
app.config.from_object(config)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
Reference in a new issue