aboutsummaryrefslogtreecommitdiff
path: root/backend/server.py
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2023-01-29 11:30:47 +1100
committerTerry Truong <terry06890@gmail.com>2023-01-29 11:30:47 +1100
commit8781fdb2b8c530a6c1531ae9e82221eb062e34fb (patch)
treeffd824aa9b945d69b47f012617ee13d98764d078 /backend/server.py
parentf5e87ae628bab0eef97b3e3e62f6d71cca9c99c0 (diff)
Adjust backend coding style
Add line spacing, section comments, and import consistency
Diffstat (limited to 'backend/server.py')
-rwxr-xr-xbackend/server.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/backend/server.py b/backend/server.py
index c953a9f..d7f6309 100755
--- a/backend/server.py
+++ b/backend/server.py
@@ -18,10 +18,8 @@ def wrappingApp(environ: dict[str, str], start_response) -> Iterable[bytes]:
""" WSGI handler that uses 'application', but also serves image files """
urlPath = environ['PATH_INFO']
if urlPath.startswith('/data/'):
- # Run WSGI script
- return application(environ, start_response)
- elif urlPath.startswith('/tol_data/img/'):
- # Serve image file
+ return application(environ, start_response) # Run WSGI script
+ elif urlPath.startswith('/tol_data/img/'): # Serve image file
imgPath = os.path.join(os.getcwd(), urlPath[1:])
if os.path.exists(imgPath):
imgType = mimetypes.guess_type(imgPath)[0]
@@ -33,6 +31,7 @@ def wrappingApp(environ: dict[str, str], start_response) -> Iterable[bytes]:
else:
start_response('404 Not Found', [('Content-type', 'text/plain')])
return [b'Unrecognised path']
+
# Start server
with simple_server.make_server('', 8000, wrappingApp) as httpd:
print('Serving HTTP on port 8000...')