mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-22 07:51:00 +00:00
Merge pull request #596 from cyrinux/fix/ipv6-compat
fix: make libretranslate works with ipv6
This commit is contained in:
commit
6ae0091c4b
5 changed files with 8 additions and 4 deletions
|
@ -42,4 +42,4 @@ RUN if [ "$with_models" = "true" ]; then \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
ENTRYPOINT [ "./venv/bin/libretranslate", "--host", "0.0.0.0" ]
|
ENTRYPOINT [ "./venv/bin/libretranslate", "--host", "*" ]
|
||||||
|
|
|
@ -40,4 +40,4 @@ RUN if [ "$with_models" = "true" ]; then \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
ENTRYPOINT [ "./venv/bin/libretranslate", "--host", "0.0.0.0" ]
|
ENTRYPOINT [ "./venv/bin/libretranslate", "--host", "*" ]
|
||||||
|
|
|
@ -42,4 +42,4 @@ RUN pip3 install Babel==2.12.1 && python3 scripts/compile_locales.py \
|
||||||
# ENV LD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/cuda/lib64
|
# ENV LD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/cuda/lib64
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
ENTRYPOINT [ "libretranslate", "--host", "0.0.0.0" ]
|
ENTRYPOINT [ "libretranslate", "--host", "*" ]
|
||||||
|
|
|
@ -215,6 +215,10 @@ def main():
|
||||||
if '--wsgi' in sys.argv:
|
if '--wsgi' in sys.argv:
|
||||||
return app
|
return app
|
||||||
else:
|
else:
|
||||||
|
if args.debug and args.host == "*":
|
||||||
|
# '::' will listen on both ipv6 and ipv4
|
||||||
|
args.host = "::"
|
||||||
|
|
||||||
if args.debug:
|
if args.debug:
|
||||||
app.run(host=args.host, port=args.port)
|
app.run(host=args.host, port=args.port)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
url='http://0.0.0.0:5000/translate',
|
url='http://localhost:5000/translate',
|
||||||
headers={'Content-Type': 'application/json'},
|
headers={'Content-Type': 'application/json'},
|
||||||
json={
|
json={
|
||||||
'q': 'Hello World!',
|
'q': 'Hello World!',
|
||||||
|
|
Loading…
Reference in a new issue