From 0a9b2c2e5eca8a04e37fbdd423379882863237c2 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Sat, 21 Jan 2023 12:21:03 +1100 Subject: Adjust backend coding style Increase line spacing, add section comments, etc --- backend/server.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'backend/server.py') diff --git a/backend/server.py b/backend/server.py index 70e847b..5c3904a 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('/hist_data/img/'): - # Serve image file + return application(environ, start_response) # Run WSGI script + elif urlPath.startswith('/hist_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...') -- cgit v1.2.3