14 lines
411 B
Python
14 lines
411 B
Python
|
import http.server
|
||
|
import socketserver
|
||
|
|
||
|
PORT = 8000
|
||
|
DIRECTORY = "."
|
||
|
|
||
|
class Handler(http.server.SimpleHTTPRequestHandler):
|
||
|
def __init__(self, *args, **kwargs):
|
||
|
super().__init__(*args, directory=DIRECTORY, **kwargs)
|
||
|
|
||
|
# Запуск сервера на порту 8000
|
||
|
with socketserver.TCPServer(("", PORT), Handler) as httpd:
|
||
|
print(f"Serving at http://localhost:{PORT}")
|
||
|
httpd.serve_forever()
|