forked from GithubMirrors/cardconjurer
Dependency setup
- Poetry for maintaining python server executable - Reroll Jetbrains configs - Update readme - Add launcher build pipeline
This commit is contained in:
40
launcher.py
Normal file
40
launcher.py
Normal file
@@ -0,0 +1,40 @@
|
||||
"""
|
||||
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.")
|
Reference in New Issue
Block a user