print("serving at port", PORT)
httpd.serve_forever()
+
+:class:`SimpleHTTPRequestHandler` can also be subclassed to enhance behavior,
+such as using different index file names by overriding the class attribute
+:attr:`index_pages`.
+
.. _http-server-cli:
:mod:`http.server` can also be invoked directly using the :option:`-m`
"""
- index_pages = ["index.html", "index.htm"]
server_version = "SimpleHTTP/" + __version__
+ index_pages = ("index.html", "index.htm")
extensions_map = _encodings_map_default = {
'.gz': 'application/gzip',
'.Z': 'application/octet-stream',
'.xz': 'application/x-xz',
}
- def __init__(self, *args, directory=None, index_pages=None, **kwargs):
+ def __init__(self, *args, directory=None, **kwargs):
if directory is None:
directory = os.getcwd()
- if index_pages is not None:
- self.index_pages = index_pages
self.directory = os.fspath(directory)
super().__init__(*args, **kwargs)