Files
cardconjurer/serve.py
MrTeferi 432bdc998b Housekeeping
- Moving to HTMX integration
- Improving links for local use
- File structure
- Hiding clutter
2022-11-21 16:17:13 -06:00

25 lines
580 B
Python

# Python 3 server example
from http.server import SimpleHTTPRequestHandler, HTTPServer
import os
NAME = "localhost"
PORT = 8080
DIRECTORY = os.getcwd()
class Handler(SimpleHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, directory=DIRECTORY, **kwargs)
if __name__ == "__main__":
webServer = HTTPServer((NAME, PORT), Handler)
print("Server started http://%s:%s" % (NAME, PORT))
try:
webServer.serve_forever()
except KeyboardInterrupt:
pass
webServer.server_close()
print("Server stopped.")