import asyncio import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).parent)) from database import init_db import logging logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s" ) logger = logging.getLogger(__name__) async def main(): try: logger.info("Debut de l'initialisation") await init_db() logger.info("Initialisation terminee") print("\nInitialisation terminee") print("\nBase de données créée avec succès !") return True except Exception as e: print(f"\nErreur lors de l'initialisation: {e}") logger.exception("Détails de l'erreur:") return False if __name__ == "__main__": result = asyncio.run(main()) sys.exit(0 if result else 1)