Scheduler/Webserver should never use Internal API, so calling any method decorated with internal_api_call should still execute them locally
"""Sync appbuilder roles to DB"""
    
    
    
    
    if conf.getboolean("webserver", "UPDATE_FAB_PERMS"):
        flask_app.appbuilder.sm.sync_roles()
def create_app(config=None, testing=False):
    """Create a new instance of Airflow WWW app"""
    flask_app = Flask(__name__)
    flask_app.secret_key = conf.get("webserver", "SECRET_KEY")
    flask_app.config["PERMANENT_SESSION_LIFETIME"] = timedelta(minutes=settings.get_session_lifetime_config())
    flask_app.config.from_pyfile(settings.WEBSERVER_CONFIG, silent=True)
    flask_app.config["APP_NAME"] = conf.get(section="webserver", key="instance_name", fallback="Airflow")
    flask_app.config["TESTING"] = testing
    flask_app.config["SQLALCHEMY_DATABASE_URI"] = conf.get("database", "SQL_ALCHEMY_CONN")
    url = make_url(flask_app.config["SQLALCHEMY_DATABASE_URI"])
    if url.drivername == "sqlite" and url.database and not url.database.startswith("/"):
        raise AirflowConfigException(
            f'Cannot use relative path: `{conf.get("database", "SQL_ALCHEMY_CONN")}` to connect to sqlite. '
            "Please use absolute path such as `sqlite:////tmp/airflow.db`."
        )
    flask_app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False