def autodiscover_siteprefs(admin_site=None):
if admin_site is None:<EOL><INDENT>admin_site = admin.site<EOL><DEDENT>if '<STR_LIT>' not in sys.argv[<NUM_LIT:0>] or (len(sys.argv) > <NUM_LIT:1> and sys.argv[<NUM_LIT:1>] in MANAGE_SAFE_COMMANDS):<EOL><INDENT>import_prefs()<EOL>Preference.read_prefs(get_prefs())<EOL>register_admin_models(admin_site)<EOL><DEDENT>
Automatically discovers and registers all preferences available in all apps.

    :param admin.AdminSite admin_site: Custom AdminSite object.