forked from GithubMirrors/cardconjurer
Housekeeping
- Moving to HTMX integration - Improving links for local use - File structure - Hiding clutter
This commit is contained in:
24
serve.py
Normal file
24
serve.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# 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.")
|
Reference in New Issue
Block a user