import http.server import socketserver import threading import os import time # Configuration PORT = 7860 DOSSIER_SITE = "html" PAGE_PAR_DEFAUT = "home.html" class CustomHandler(http.server.SimpleHTTPRequestHandler): def do_GET(self): if self.path in ("/", "/index.html"): self.path = f"/{PAGE_PAR_DEFAUT}" return super().do_GET() def start_http_server(): os.chdir(DOSSIER_SITE) httpd = socketserver.TCPServer(("", PORT), CustomHandler) print(f"[HTTP] Serveur local : http://localhost:{PORT}") httpd.serve_forever() if __name__ == '__main__': threading.Thread(target=start_http_server, daemon=True).start() while True: time.sleep(10)