From 732e984382d424ceeab2c9e32ea160d770180d9e Mon Sep 17 00:00:00 2001 From: Cyril Levis Date: Wed, 6 Mar 2024 15:46:29 +0100 Subject: [PATCH] fix: make libretranslate with ipv6 --- libretranslate/main.py | 4 ++++ scripts/healthcheck.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libretranslate/main.py b/libretranslate/main.py index 8337c70..6866a55 100644 --- a/libretranslate/main.py +++ b/libretranslate/main.py @@ -215,6 +215,10 @@ def main(): if '--wsgi' in sys.argv: return app else: + if args.debug and args.host == "*": + # '::' will listen on both ipv6 and ipv4 + args.host = "::" + if args.debug: app.run(host=args.host, port=args.port) else: diff --git a/scripts/healthcheck.py b/scripts/healthcheck.py index aa5fcaf..2f0d22f 100644 --- a/scripts/healthcheck.py +++ b/scripts/healthcheck.py @@ -1,7 +1,7 @@ import requests response = requests.post( - url='http://[::1]:5000/translate', + url='http://localhost:5000/translate', headers={'Content-Type': 'application/json'}, json={ 'q': 'Hello World!',