]>
git.datanom.net - wpp.git/blob - app/__init__.py
1 from flask
import Flask
2 from flask_bootstrap
import Bootstrap
3 from flask_sqlalchemy
import SQLAlchemy
4 from config
import ADMINS
, MAIL_SERVER
, MAIL_PORT
, MAIL_USERNAME
, MAIL_PASSWORD
5 from flask_login
import LoginManager
8 app
.config
.from_object('config')
11 lm
.login_view
= 'login'
13 bootstrap
= Bootstrap(app
)
18 from logging
.handlers
import SMTPHandler
, RotatingFileHandler
20 if MAIL_USERNAME
or MAIL_PASSWORD
:
21 credentials
= (MAIL_USERNAME
, MAIL_PASSWORD
)
22 mail_handler
= SMTPHandler((MAIL_SERVER
, MAIL_PORT
), 'no-reply@' + MAIL_SERVER
, ADMINS
, 'WPP failure', credentials
)
23 mail_handler
.setLevel(logging
.ERROR
)
24 mail_handler
.setFormatter(logging
.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'))
25 app
.logger
.addHandler(mail_handler
)
27 file_handler
= RotatingFileHandler('log/wpp.log', 'a', 1 * 1024 * 1024, 10)
28 file_handler
.setFormatter(logging
.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'))
29 app
.logger
.addHandler(file_handler
)
31 app
.logger
.setLevel(logging
.INFO
)
32 file_handler
.setLevel(logging
.INFO
)
33 app
.logger
.info('wpp startup')
35 from app
import views
, models
This page took 0.094571 seconds and 6 git commands to generate.