diff options
| author | Terry Truong <terry06890@gmail.com> | 2023-01-21 12:21:03 +1100 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2023-01-21 12:32:01 +1100 |
| commit | 0a9b2c2e5eca8a04e37fbdd423379882863237c2 (patch) | |
| tree | 1812bdb6bb13e4f76fdd7ef04075b291f775c213 /backend/server.py | |
| parent | 8321e2f92dbc073b8f1de87895d6620a2021b22e (diff) | |
Adjust backend coding style
Increase line spacing, add section comments, etc
Diffstat (limited to 'backend/server.py')
| -rwxr-xr-x | backend/server.py | 7 |
1 files changed, 3 insertions, 4 deletions
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...') |
