<s> from flask import Flask <EOL> from raven . contrib . flask import Sentry <EOL> from flask_debugtoolbar import DebugToolbarExtension <EOL> from werkzeug . contrib . profiler import ProfilerMiddleware <EOL> from chassis . views import CatAPI <EOL> from chassis . views import api , cache <EOL> from chassis . models import db <EOL> def create_app ( config = { } ) : <EOL> app = Flask ( "<STR_LIT>" ) <EOL> app . config . from_envvar ( "<STR_LIT>" ) <EOL> app . config . update ( config ) <EOL> sentry . init_app ( app ) <EOL> api . init_app ( app ) <EOL> cache . init_app ( app ) <EOL> db . init_app ( app ) <EOL> api . add_resource ( CatAPI , "<STR_LIT>" ) <EOL> with app . app_context ( ) : <EOL> db . create_all ( ) <EOL> if app . debug : <EOL> DebugToolbarExtension ( app ) <EOL> if app . config . get ( "<STR_LIT>" , False ) : <EOL> app . wsgi_app = ProfilerMiddleware ( app . wsgi_app , <EOL> restrictions = [ <NUM_LIT:30> ] , <EOL> sort_by = ( "<STR_LIT:time>" , "<STR_LIT>" ) ) <EOL> return app <EOL> sentry = Sentry ( ) </s>
