From 50eddb5731ae9ba44513f9d0be7b4885fdff8b9e Mon Sep 17 00:00:00 2001 From: Digital Studium Date: Sun, 23 Jul 2023 16:11:26 +0300 Subject: [PATCH] Update start_httpd --- functions.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/functions.py b/functions.py index 855b6bc..940a7bb 100644 --- a/functions.py +++ b/functions.py @@ -20,9 +20,10 @@ def copy_file(src, dst): os.makedirs(os.path.dirname(dst), exist_ok=True) shutil.copy2(src, dst) + # Функция для запуска веб-сервера -def start_httpd(directory: Path, port: int = 8000): - print(f"Listen on port {port}, serving from {directory}...") +def start_httpd(directory: Path, port: int = 8000, interface: str = 'localhost'): + print(f"Listen on http://{interface}:{port}, serving from '{directory}' directory...") handler = partial(SimpleHTTPRequestHandler, directory=directory) - httpd = HTTPServer(('localhost', port), handler) + httpd = HTTPServer((interface, port), handler) httpd.serve_forever() \ No newline at end of file