How to run a http server which serves a specific path?

后端 未结 6 734
萌比男神i
萌比男神i 2020-12-02 12:02

this is my Python3 project hiearchy:

projet
  \\
  script.py
  web
    \\
    index.html

From script.py, I would like to run a

6条回答
  •  萌比男神i
    2020-12-02 12:45

    If you just want serve static file you can do it by running SimpleHTTPServer module using python 2:

     python -m SimpleHTTPServer
    

    Or with python 3:

     python3 -m http.server
    

    This way you do not need to write any script.

提交回复
热议问题