python -m SimpleHTTPServer - Listening on 0.0.0.0:8000 but http://0.0.0.0:8000/test.html gives “Page Not Found”

前端 未结 10 1315
情歌与酒
情歌与酒 2020-12-29 04:54

After cding to my folder I enter

python -m SimpleHTTPServer

and get

Serving HTTP on 0.0.0.0 port 8000 ...
<
相关标签:
10条回答
  • 2020-12-29 05:17
    1. create a directory e.g. mkdir HTTPServer_dir
    2. move inside the folder cd HTTPServer_dir
    3. typing the command (according to python version) python -m SimpleHTTPSever 8000 (or the port you want)
    4. go on a browser and type http://127.0.0.1:8000/

    Done !!!

    You could make a simple index.html page inside the HTTPServer_dir so you can see an html page instead of directory listing

    0 讨论(0)
  • 2020-12-29 05:17

    This worked for me on Windows 8. Did not download any software!

    In cmd:

    1. Go to the directory that your file is in.
    2. python -m SimpleHTTPServer
      Shows "Serving HTTP on 0.0.0.0 port 8000 ..."

    Now, find out your system name. For Windows 8: Control Panel -> System. You will see the computer name here. Let's say it is "Abhinav".

    Your local server will be hosted at "Abhinav.local:8000".

    0 讨论(0)
  • 2020-12-29 05:18

    Sometimes the same port number is used by some other service. So we can try with some other port like

    python -m SimpleHTTPServer 9090
    

    And then simply hit http://{your system IP}:9090/

    this works for me.

    0 讨论(0)
  • 2020-12-29 05:20

    Try browsing to http://localhost:8000/test.html or http://127.0.0.1:8000/test.html (those two should be exactly the same thing as long as your hosts file isn't all crazy-like).

    0.0.0.0 is usually used by Windows as the "Not connected" IP, and can also be used as a sort of wildcard for when dealing with IPs. I am a bit confused at why your HTTP server is trying to host on 0.0.0.0, though. You may need to edit some config files and set that to 'localhost' or '127.0.0.1'.

    0 讨论(0)
  • 2020-12-29 05:28

    You must type in the ip-address of the computer your connecting to for example 192.168.0.2:8000 Change that to the ip-address of your server.

    0 讨论(0)
  • 2020-12-29 05:30

    this worked for me,replacing your machine name with
    http://localhost:x000

    0 讨论(0)
提交回复
热议问题