I have python 3.8.1 installed on my Windows 10 PC.
I run the following command from PowerShell in the directory I want to set as server
python -m http.server 8000
I get the following response after running the command
Serving HTTP on:: port 8000 ( http://[::]:8000/ )...
I'm able to access the directory on localhost:8000 but not 0.0.0.0:8000 or http://127.0.0.1:8000/
I can't access the server on my external Ip from the same PC or a different PC on the Same.network.
I checked the firewall to make sure Python was an accepted app and my.network was set to private.
Even though the documentation didn't state this. I presumed that the server wasn't binding to all the available ports. In PowerShell, I tried running
python -m http.server 8000 --bind 0.0.0.0
I got the following response instead
Serving HTTP on 0.0.0.0 port 8000 ( http://0.0.0.0:8000/ )...
I was able to access the Server on the following addresses
Hope this helps someone other than me
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.