KCH / serve.py
bsamadi's picture
Update to pixi env
c032460
raw
history blame contribute delete
577 Bytes
#!/usr/bin/env python3
"""Simple HTTP server for serving the rendered Quarto site."""
import http.server
import socketserver
import os
PORT = 7860
DIRECTORY = "src/_site"
class Handler(http.server.SimpleHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, directory=DIRECTORY, **kwargs)
if __name__ == "__main__":
os.chdir(os.path.dirname(os.path.abspath(__file__)))
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print(f"Serving {DIRECTORY} at http://0.0.0.0:{PORT}")
httpd.serve_forever()