Update start_httpd
This commit is contained in:
parent
7b3e66514a
commit
50eddb5731
|
@ -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()
|
Loading…
Reference in New Issue