aboutsummaryrefslogtreecommitdiff
path: root/serve.py
blob: d6174df097851d250bbf6df601105bd68315a537 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python3

import http.server
import socketserver

ADDR = "127.0.0.1"
PORT = 8000

Handler = http.server.SimpleHTTPRequestHandler

with socketserver.TCPServer((ADDR, PORT), Handler) as httpd:
    print(
        "** serving on http://{}:{}/ - press CTRL + C to finish...".format(ADDR, PORT)
    )
    try:
        httpd.serve_forever()
    except KeyboardInterrupt:
        print("\nFinished")