I installed this months ago and cant figure out how to access localhost through my browser. I wrote a sample flask app and ran it but cant access it outside of termux. Is there a way to do so?
python3 -m http.server
http://localhost:8000/ # on phone
However, I haven't been able to access a server running on termux on my phone from anywhere else. I suspect servers are blocked by my mobile ISP (makes sense!), but I never got to the bottom of it.Should work over wifi though.
python -m http.server 0.0.0.0:8000
That should allow you to access it externally.Edit:
Works if you just run:
python3 -m http.server
Thanks for the helpEdit[1]:
Works great with python's built in web server but wont work with flask's built in development web server.
Many mobile ISPs run NAT, you don't even get a public IP of your own during the session, just an internal one.
Alternatively, you can DIY by connecting to some other machine using SSH and establishing a reverse tunnel.