def _in_gae_environment():
 if (SETTINGS.env_name is not None):
  return (SETTINGS.env_name in ('GAE_PRODUCTION', 'GAE_LOCAL'))
 try:
  import google.appengine
  server_software = os.environ.get('SERVER_SOFTWARE', '')
  if server_software.startswith('Google App Engine/'):
   SETTINGS.env_name = 'GAE_PRODUCTION'
   return True
  elif server_software.startswith('Development/'):
   SETTINGS.env_name = 'GAE_LOCAL'
   return True
 except ImportError:
  pass
 return False

def _in_gae_environment ( ) : if ( SETTINGS . env_name is not None ) : return ( SETTINGS . env_name in ( 'GAE_PRODUCTION' , 'GAE_LOCAL' ) ) try : import google . appengine server_software = os . environ . get ( 'SERVER_SOFTWARE' , '' ) if server_software . startswith ( 'Google App Engine/' ) : SETTINGS . env_name = 'GAE_PRODUCTION' return True elif server_software . startswith ( 'Development/' ) : SETTINGS . env_name = 'GAE_LOCAL' return True except ImportError : pass return False
detects if the code is running in the app engine environment .