aboutsummaryrefslogtreecommitdiff
path: root/backend/server.py
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2022-07-09 03:20:53 +1000
committerTerry Truong <terry06890@gmail.com>2022-07-09 04:36:52 +1000
commit5569c8191ae02f109254282b5943e3ed40032018 (patch)
tree0ec5c2f6176c470aaeaa41be9bfbb0825554b764 /backend/server.py
parent347f5127929b17671c75734af5a374ec4f39b5ae (diff)
Replace CGI script with WSGI script and dev server
Diffstat (limited to 'backend/server.py')
-rwxr-xr-xbackend/server.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/backend/server.py b/backend/server.py
new file mode 100755
index 0000000..a00ab7f
--- /dev/null
+++ b/backend/server.py
@@ -0,0 +1,18 @@
+#!/usr/bin/python3
+
+import sys
+from wsgiref.simple_server import make_server
+from tilo import application
+
+usageInfo = f"""
+Usage: {sys.argv[0]}
+
+Runs a basic dev server that serves a WSGI script
+"""
+if len(sys.argv) > 1:
+ print(usageInfo, file=sys.stderr)
+ sys.exit(1)
+
+with make_server('', 8000, application) as httpd:
+ print("Serving HTTP on port 8000...")
+ httpd.serve_forever()