Merge pull request #66 from int00h5525/master

Fix Python 3.5 vs 3.7 issue
This commit is contained in:
Neale Pickett 2019-06-11 17:05:07 -06:00 committed by GitHub
commit 69ca01cafb
3 changed files with 11 additions and 2 deletions

View File

@ -16,6 +16,5 @@ COPY devel /app/
COPY example-puzzles /puzzles/ COPY example-puzzles /puzzles/
COPY theme /theme/ COPY theme /theme/
WORKDIR /moth/
ENTRYPOINT [ "python3", "/app/devel-server.py" ] ENTRYPOINT [ "python3", "/app/devel-server.py" ]
CMD [ "--bind", "0.0.0.0:8080", "--puzzles", "/puzzles", "--theme", "/theme" ] CMD [ "--bind", "0.0.0.0:8080", "--puzzles", "/puzzles", "--theme", "/theme" ]

View File

@ -23,8 +23,14 @@ and comes with a JavaScript-based scoreboard to display team rankings.
Running a Development Server Running a Development Server
============================ ============================
To use example puzzles
docker run --rm -it -p 8080:8080 dirtbags/moth-devel docker run --rm -it -p 8080:8080 dirtbags/moth-devel
or, to use your own puzzles
docker run --rm -it -p 8080:8080 -v /path/to/puzzles:/puzzles:ro dirtbags/moth-devel
And point a browser to http://localhost:8080/ (or whatever host is running the server). And point a browser to http://localhost:8080/ (or whatever host is running the server).
The development server includes a number of Python libraries that we have found useful in writing puzzles. The development server includes a number of Python libraries that we have found useful in writing puzzles.

View File

@ -43,8 +43,12 @@ class MothRequestHandler(http.server.SimpleHTTPRequestHandler):
def __init__(self, request, client_address, server): def __init__(self, request, client_address, server):
self.directory = str(server.args["theme_dir"]) self.directory = str(server.args["theme_dir"])
try:
super().__init__(request, client_address, server, directory=server.args["theme_dir"])
except TypeError:
super().__init__(request, client_address, server) super().__init__(request, client_address, server)
# Backport from Python 3.7 # Backport from Python 3.7
def translate_path(self, path): def translate_path(self, path):
# I guess we just hope that some other thread doesn't call getcwd # I guess we just hope that some other thread doesn't call getcwd