Using Python's http.server, can I disable directory listings?

Viewed 711

If I run python -m http.server on the command line, then navigate in a browser to a directory that doesn't contain index.html, I see a directory listing (as documented here).

A production server in this situation, however, will generally refuse to list the contents of the directory and instead return status 403 or 404. Can I configure http.server to do the same?

0 Answers
Related