old_contents: # -*- coding: utf-8 -*-
  
  import os
  import sys
  
  from byceps.application import create_app, init_app
  
  
  CONFIG_ENV_VAR_NAME = 'BYCEPS_CONFIG'
  
  
  environment = os.environ.get(CONFIG_ENV_VAR_NAME)
  
  if environment is None:
      sys.stderr.write("Environment variable '{}' must be set but isn't."
                       .format(CONFIG_ENV_VAR_NAME))
      sys.exit()
  
  app = create_app(environment)
  init_app(app)
  
new_contents: # -*- coding: utf-8 -*-
  
  import sys
  
  try:
      from byceps.application_factory import app
  except Exception as e:
      sys.stderr.write("{}\n".format(e))
      sys.exit()
  
subject: Replace redundant code