A simple website with python using SimpleHTTPServer and SocketServer, how to only display the html file and not the whole directory?

前端 未结 3 1589
梦谈多话
梦谈多话 2020-12-28 22:46

How do I only display simplehttpwebsite_content.html when I visit localhost:8080? So that I can\'t see my filetree, only the webpage. All these fil

3条回答
  •  有刺的猬
    2020-12-28 23:23

    you should call your file index.html, that's the page that gets served automatically instead of listing the directory.

    the other possibility would be to override the handlers list_directory(self, path) method.

提交回复
热议问题