Serve directory in Python 3

前端 未结 2 1366
自闭症患者
自闭症患者 2021-01-19 07:20

I\'ve got this basic python3 server but can\'t figure out how to serve a directory.

class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
        def do_GE         


        
2条回答
  •  面向向阳花
    2021-01-19 08:18

    if you are using 3.7, you can simply serve up a directory where your html files, eg. index.html is still

    python -m http.server 8080 --bind 127.0.0.1 --directory \your_directory\
    

    for the docs

提交回复
热议问题