mirror of
https://github.com/Investigamer/cardconjurer.git
synced 2025-07-25 12:25:02 -05:00

- Poetry for maintaining python server executable - Reroll Jetbrains configs - Update readme - Add launcher build pipeline
41 lines
706 B
Python
41 lines
706 B
Python
"""
|
|
IMPORTS
|
|
"""
|
|
from http.server import SimpleHTTPRequestHandler, HTTPServer
|
|
import webbrowser
|
|
import os
|
|
|
|
"""
|
|
SETTINGS
|
|
"""
|
|
|
|
NAME = "localhost"
|
|
PORT = 8080
|
|
DIRECTORY = os.getcwd()
|
|
|
|
"""
|
|
REQUEST HANDLER
|
|
"""
|
|
|
|
|
|
class Handler(SimpleHTTPRequestHandler):
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, directory=DIRECTORY, **kwargs)
|
|
|
|
"""
|
|
START APP
|
|
"""
|
|
|
|
if __name__ == "__main__":
|
|
webServer = HTTPServer((NAME, PORT), Handler)
|
|
print("Server started http://%s:%s" % (NAME, PORT))
|
|
|
|
try:
|
|
webbrowser.open('http://localhost:8080', new=2)
|
|
webServer.serve_forever()
|
|
except KeyboardInterrupt:
|
|
pass
|
|
|
|
webServer.server_close()
|
|
print("Server stopped.")
|