25 lines
617 B
Python
25 lines
617 B
Python
import logging
|
|
import os
|
|
|
|
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
|
|
|
|
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)
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
Principal(app, use_sessions=True)
|
|
|
|
login_manager = LoginManager()
|
|
login_manager.init_app(app)
|
|
login_manager.login_view = 'signin'
|
|
|
|
mail = Mail()
|
|
mail.init_app(app)
|