]>
git.datanom.net - pwp.git/blob - app/__init__.py
1 from flask
import Flask
2 from flask_bootstrap
import Bootstrap
3 from config
import ADMINS
, MAIL_SERVER
, MAIL_PORT
, MAIL_USERNAME
, MAIL_PASSWORD
4 from flask_login
import LoginManager
5 from flask_wtf
.csrf
import CSRFProtect
8 app
.config
.from_object('config')
11 lm
.login_view
= 'login'
12 bootstrap
= Bootstrap(app
)
19 from logging
.handlers
import SMTPHandler
, RotatingFileHandler
21 if MAIL_USERNAME
or MAIL_PASSWORD
:
22 credentials
= (MAIL_USERNAME
, MAIL_PASSWORD
)
23 mail_handler
= SMTPHandler((MAIL_SERVER
, MAIL_PORT
), 'no-reply@' + MAIL_SERVER
, ADMINS
, 'PWP failure', credentials
)
24 mail_handler
.setLevel(logging
.ERROR
)
25 mail_handler
.setFormatter(logging
.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'))
26 app
.logger
.addHandler(mail_handler
)
28 file_handler
= RotatingFileHandler('log/pwp.log', 'a', 1 * 1024 * 1024, 10)
29 file_handler
.setFormatter(logging
.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'))
30 app
.logger
.addHandler(file_handler
)
32 app
.logger
.setLevel(logging
.INFO
)
33 file_handler
.setLevel(logging
.INFO
)
34 app
.logger
.info('pwp startup')
36 from app
import views
, models
37 lm
.anonymous_user
= models
.MyAnonymous
This page took 0.115773 seconds and 6 git commands to generate.