Add a binding to localhost when running:
python -m http.server 8000 --bind localhost
Related:
http.server
ERR_ADDRESS_INVALID
ERR_CONNECTION_REFUSED