mgt c7 finish
This commit is contained in:
@@ -3,7 +3,7 @@ from config import Config
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from flask_migrate import Migrate
|
||||
from flask_login import LoginManager
|
||||
import logging
|
||||
import logging, sys
|
||||
from logging.handlers import SMTPHandler
|
||||
|
||||
app = Flask(__name__)
|
||||
@@ -13,5 +13,25 @@ migrate = Migrate(app, db)
|
||||
login = LoginManager(app)
|
||||
login.login_view = 'login'
|
||||
|
||||
if not app.debug:
|
||||
if app.config['MAIL_SERVER']:
|
||||
auth = None
|
||||
secure = None
|
||||
mail_handler = SMTPHandler(
|
||||
mailhost=(app.config['MAIL_SERVER'], app.config['MAIL_PORT']),
|
||||
fromaddr=app.config['FROM_ADDRESS'],
|
||||
toaddrs=app.config['ADMINS'], subject='MB failure.',
|
||||
credentials=auth, secure=secure)
|
||||
mail_handler.setLevel(logging.ERROR)
|
||||
app.logger.addHandler(mail_handler)
|
||||
|
||||
if app.config['DC_LOGGING']:
|
||||
print('#################### DEBUGHERE', file=sys.stderr)
|
||||
dclog = logging.StreamHandler(stream=sys.stderr)
|
||||
dclog.setLevel(logging.INFO)
|
||||
dclog.propagate = False
|
||||
app.logger.addHandler(dclog)
|
||||
|
||||
|
||||
from app import routes, models, errors
|
||||
|
||||
|
Reference in New Issue
Block a user