Half way through migration away from sqlalchemy
[pwp.git] / run.py
CommitLineData
e5424f29
MR
1#!flask/bin/python
2from app import app
fc01a3eb
MR
3from config import ADMINS, MAIL_SERVER, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD
4import logging
5
6app.debug = True
7
8if not app.debug:
9 from logging.handlers import SMTPHandler, RotatingFileHandler
10 credentials = None
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)
17
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)
22else:
23# from flask_debugtoolbar import DebugToolbarExtension
24
25# toolbar = DebugToolbarExtension(app)
26 app.jinja_env.auto_reload = True
27 app.config['TEMPLATES_AUTO_RELOAD'] = True
28
29app.logger.setLevel(logging.DEBUG)
30app.logger.info('pwp startup')
31#from werkzeug.security import generate_password_hash
32#print (generate_password_hash('test', method='sha256'))
33app.run()
This page took 0.031363 seconds and 5 git commands to generate.