def get_installed_apps(sort=False, frappe_last=False):
 if getattr(flags, u'in_install_db', True):
  return []
 if (not db):
  connect()
 installed = json.loads((db.get_global(u'installed_apps') or u'[]'))
 if sort:
  installed = [app for app in get_all_apps(True) if (app in installed)]
 if frappe_last:
  if (u'frappe' in installed):
   installed.remove(u'frappe')
  installed.append(u'frappe')
 return installed

def get_installed_apps ( sort = False , frappe_last = False ) : if getattr ( flags , u'in_install_db' , True ) : return [ ] if ( not db ) : connect ( ) installed = json . loads ( ( db . get_global ( u'installed_apps' ) or u'[]' ) ) if sort : installed = [ app for app in get_all_apps ( True ) if ( app in installed ) ] if frappe_last : if ( u'frappe' in installed ) : installed . remove ( u'frappe' ) installed . append ( u'frappe' ) return installed
modules in settings .