# Coverage for my_app/__init__ : 100%

## 30 statements 30 run 0 missing 0 excluded

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | import os from flask import Flask from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.babel import Babel ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif']) ALLOWED_LANGUAGES = { 'en': 'English', 'fr': 'French', } RECEPIENTS = ['some_receiver@gmail.com'] app = Flask(__name__) app.config['UPLOAD_FOLDER'] = os.path.realpath('.') + '/my_app/static/uploads' app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db' app.config['WTF_CSRF_SECRET_KEY'] = 'random key for form' db = SQLAlchemy(app) app.config['LOG_FILE'] = 'application.log' if not app.debug: import logging from logging import FileHandler, Formatter from logging.handlers import SMTPHandler file_handler = FileHandler(app.config['LOG_FILE']) file_handler.setLevel(logging.INFO) app.logger.addHandler(file_handler) mail_handler = SMTPHandler( ("smtp.gmail.com", 587), 'sender@gmail.com', RECEPIENTS, 'Error occurred in your application', ('some_email@gmail.com', 'some_gmail_password'), secure=()) mail_handler.setLevel(logging.ERROR) app.logger.addHandler(mail_handler) for handler in [file_handler, mail_handler]: handler.setFormatter(Formatter( '%(asctime)s %(levelname)s: %(message)s ' '[in %(pathname)s:%(lineno)d]' )) babel = Babel(app) app.secret_key = 'some_random_key' from my_app.catalog.views import catalog app.register_blueprint(catalog) db.create_all()