]>
git.datanom.net - pwp.git/blob - run.py
3 from config
import ADMINS
, MAIL_SERVER
, MAIL_PORT
, MAIL_USERNAME
, MAIL_PASSWORD
9 from logging
.handlers
import SMTPHandler
, RotatingFileHandler
11 if MAIL_USERNAME
or MAIL_PASSWORD
:
12 credentials
= (MAIL_USERNAME
, MAIL_PASSWORD
)
13 mail_handler
= SMTPHandler((MAIL_SERVER
, MAIL_PORT
), 'no-reply@' + MAIL_SERVER
, ADMINS
, 'PWP failure', credentials
)
14 mail_handler
.setLevel(logging
.ERROR
)
15 mail_handler
.setFormatter(logging
.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'))
16 app
.logger
.addHandler(mail_handler
)
18 file_handler
= RotatingFileHandler('log/pwp.log', 'a', 1 * 1024 * 1024, 10)
19 file_handler
.setFormatter(logging
.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'))
20 app
.logger
.addHandler(file_handler
)
21 file_handler
.setLevel(logging
.DEBUG
)
23 # from flask_debugtoolbar import DebugToolbarExtension
25 # toolbar = DebugToolbarExtension(app)
26 app
.jinja_env
.auto_reload
= True
27 app
.config
['TEMPLATES_AUTO_RELOAD'] = True
29 app
.logger
.setLevel(logging
.DEBUG
)
30 app
.logger
.info('pwp startup')
31 #from werkzeug.security import generate_password_hash
32 #print (generate_password_hash('test', method='sha256'))
This page took 0.085778 seconds and 6 git commands to generate.