from django.conf import settings import importlib def load_viewset_registries(router): """ Parcourt toutes les apps installées et appelle leur register_viewsets(router) si présent. """ for app in settings.INSTALLED_APPS: module_path = f"{app}.api.registry" try: module = importlib.import_module(module_path) if hasattr(module, "register_viewsets"): module.register_viewsets(router) except ModuleNotFoundError: continue except AttributeError as e: print(f"[ERROR] Could not import {module_path}: {e}")