def create_app():
config = load_config()<EOL>app = Flask(__name__)<EOL>app.config.from_object(config)<EOL>app.wsgi_app = ProxyFix(app.wsgi_app)<EOL>CsrfProtect(app)<EOL>if app.debug or app.testing:<EOL><INDENT>DebugToolbarExtension(app)<EOL>app.wsgi_app = SharedDataMiddleware(app.wsgi_app, {<EOL>'<STR_LIT>': os.path.join(app.config.get('<STR_LIT>'), '<STR_LIT>')<EOL>})<EOL><DEDENT>else:<EOL><INDENT>app.logger.addHandler(logging.StreamHandler())<EOL>app.logger.setLevel(logging.ERROR)<EOL>if app.config.get('<STR_LIT>'):<EOL><INDENT>from .utils.sentry import sentry<EOL>sentry.init_app(app, dsn=app.config.get('<STR_LIT>'))<EOL><DEDENT>app.wsgi_app = SharedDataMiddleware(app.wsgi_app, {<EOL>'<STR_LIT>': os.path.join(app.config.get('<STR_LIT>'), '<STR_LIT>'),<EOL>'<STR_LIT>': os.path.join(app.config.get('<STR_LIT>'), '<STR_LIT>'),<EOL>'<STR_LIT>': os.path.join(app.config.get('<STR_LIT>'), '<STR_LIT>')<EOL>})<EOL><DEDENT>register_db(app)<EOL>register_routes(app)<EOL>register_jinja(app)<EOL>register_error_handle(app)<EOL>register_hooks(app)<EOL>return app<EOL>
Create Flask app.