如何查看本地主机中的目录列表?

How to see directory listing inside localhost?

我使用 python -m http.server 8000 为我的项目设置本地测试服务器。

当我的项目根目录有 index.html 文件时,然后在 http://localhost:8000/ 我看到那个 index.html 文件的内容,如下图所示。

但是当我的项目根目录没有 index.html 文件时,我在 http://localhost:8000/ 看到目录列表,如下图所示。

所以我的问题是 即使我在项目的根目录下有 index.html 文件,是否有任何可能的方法来查看目录列表

使用 do_GET() 为我完成了工作。