old_contents: # -*- coding: utf-8 -*-
  '''The app module, containing the app factory function.'''
  from flask import Flask, render_template
  
  from dash.settings import ProdConfig
  from dash.assets import assets
  from dash.extensions import (
      bcrypt,
      cache,
      db,
      login_manager,
      migrate,
      api,
  )
  from dash import public, user, catalog
  
  
  def create_app(config_object=ProdConfig):
      '''An application factory, as explained here:
          http://flask.pocoo.org/docs/patterns/appfactories/
  
      :param config_object: The configuration object to use.
      '''
      app = Flask(__name__)
      app.config.from_object(config_object)
      register_extensions(app)
      register_blueprints(app)
      register_errorhandlers(app)
      if not app.debug:
          import logging
          from logging.handlers import StreamHandler
          log_handler = StreamHandler()
          log_handler.setLevel(logging.ERROR)
          app.logger.addHandler(log_handler)
      return app
  
  
  def register_extensions(app):
      assets.init_app(app)
      bcrypt.init_app(app)
      cache.init_app(app)
      db.init_app(app)
      login_manager.init_app(app)
      migrate.init_app(app, db)
      api.init_app(app)
  
      if app.config.get('ENV') == 'dev':
          from dash.extensions_dev import (
              debug_toolbar,
          )
          debug_toolbar.init_app(app)
  
      return None
  
  
  def register_blueprints(app):
      app.register_blueprint(public.views.blueprint)
      app.register_blueprint(user.views.blueprint)
      return None
  
  
  def register_errorhandlers(app):
      def render_error(error):
          # If a HTTPException, pull the `code` attribute; default to 500
          error_code = getattr(error, 'code', 500)
          return render_template("{0}.html".format(error_code)), error_code
      for errcode in [401, 404, 500]:
          app.errorhandler(errcode)(render_error)
      return None
  
new_contents: # -*- coding: utf-8 -*-
  '''The app module, containing the app factory function.'''
  from flask import Flask, render_template
  
  from dash.settings import ProdConfig
  from dash.assets import assets
  from dash.extensions import (
      bcrypt,
      cache,
      db,
      login_manager,
      migrate,
      api,
  )
  from dash import public, user, catalog
  
  
  def create_app(config_object=ProdConfig):
      '''An application factory, as explained here:
          http://flask.pocoo.org/docs/patterns/appfactories/
  
      :param config_object: The configuration object to use.
      '''
      app = Flask(__name__)
      app.config.from_object(config_object)
      register_extensions(app)
      register_blueprints(app)
      register_errorhandlers(app)
      if not app.debug:
          import logging
          log_handler = logging.StreamHandler()
          log_handler.setLevel(logging.ERROR)
          app.logger.addHandler(log_handler)
      return app
  
  
  def register_extensions(app):
      assets.init_app(app)
      bcrypt.init_app(app)
      cache.init_app(app)
      db.init_app(app)
      login_manager.init_app(app)
      migrate.init_app(app, db)
      api.init_app(app)
  
      if app.config.get('ENV') == 'dev':
          from dash.extensions_dev import (
              debug_toolbar,
          )
          debug_toolbar.init_app(app)
  
      return None
  
  
  def register_blueprints(app):
      app.register_blueprint(public.views.blueprint)
      app.register_blueprint(user.views.blueprint)
      return None
  
  
  def register_errorhandlers(app):
      def render_error(error):
          # If a HTTPException, pull the `code` attribute; default to 500
          error_code = getattr(error, 'code', 500)
          return render_template("{0}.html".format(error_code)), error_code
      for errcode in [401, 404, 500]:
          app.errorhandler(errcode)(render_error)
      return None
  
subject: Fix wrong import statement for log handler