python html server for web export
This commit is contained in:
20
serve.py
Executable file
20
serve.py
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Simple static file server for Bomberman HTML export."""
|
||||
|
||||
import http.server
|
||||
import socketserver
|
||||
import os
|
||||
import webbrowser
|
||||
|
||||
PORT = 3333
|
||||
DIRECTORY = "bomberman"
|
||||
|
||||
os.chdir(os.path.join(os.path.dirname(os.path.abspath(__file__)), DIRECTORY))
|
||||
|
||||
Handler = http.server.SimpleHTTPRequestHandler
|
||||
|
||||
with socketserver.TCPServer(("", PORT), Handler) as httpd:
|
||||
url = f"http://localhost:{PORT}"
|
||||
print(f"Serving at {url}")
|
||||
webbrowser.open(url)
|
||||
httpd.serve_forever()
|
||||
Reference in New Issue
Block a user