コード例 #1
0
ファイル: website.py プロジェクト: Debiprasad/hasjob
def configure():
    uploads.configure()
    search.configure()
    views.mail.init_app(app)

    log_formatter = loghandler.LocalVarFormatter()
    file_handler = logging.FileHandler(app.config['LOGFILE'])
    file_handler.setFormatter(log_formatter)
    file_handler.setLevel(logging.WARNING)
    app.logger.addHandler(file_handler)
    if app.config['ADMINS']:
        mail_handler = logging.handlers.SMTPHandler(app.config['MAIL_SERVER'],
            app.config['DEFAULT_MAIL_SENDER'][1],
            app.config['ADMINS'],
            'hasgeek-jobs failure',
            credentials = (app.config['MAIL_USERNAME'], app.config['MAIL_PASSWORD']))
        mail_handler.setLevel(logging.ERROR)
        app.logger.addHandler(mail_handler)
コード例 #2
0
ファイル: website.py プロジェクト: sengupta/hasjob
from app import app
import models, forms, views, admin, assets, uploads, search
from models import db
import loghandler

app.config.from_object(__name__)
try:
    app.config.from_object("settings")
except ImportError:
    import sys

    print >>sys.stderr, "Please create a settings.py with the necessary settings. See settings-sample.py."
    print >>sys.stderr, "You may use the site without these settings, but some features may not work."

uploads.configure()
search.configure()
views.mail.init_app(app)

log_formatter = loghandler.LocalVarFormatter()
file_handler = logging.FileHandler(app.config["LOGFILE"])
file_handler.setFormatter(log_formatter)
file_handler.setLevel(logging.WARNING)
app.logger.addHandler(file_handler)
if app.config["ADMINS"]:
    mail_handler = logging.handlers.SMTPHandler(
        app.config["MAIL_SERVER"],
        app.config["DEFAULT_MAIL_SENDER"][1],
        app.config["ADMINS"],
        "hasgeek-jobs failure",
        credentials=(app.config["MAIL_USERNAME"], app.config["MAIL_PASSWORD"]),
    )