aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2021-07-15 23:53:52 +0200
committercbdev <cb@cbcdn.com>2021-07-15 23:53:52 +0200
commit2fcb061a09cb237354ca6a5b7a0309745d3e4caf (patch)
tree7af5841ab1648796c3911af6878c63ab9e4ff3eb
parente340b9fb90c361cd59997500323a3801030b0638 (diff)
downloadcargohold-2fcb061a09cb237354ca6a5b7a0309745d3e4caf.tar.gz
cargohold-2fcb061a09cb237354ca6a5b7a0309745d3e4caf.tar.bz2
cargohold-2fcb061a09cb237354ca6a5b7a0309745d3e4caf.zip
Implement basic configuration
-rw-r--r--.gitignore2
-rw-r--r--backend/config.py1
-rw-r--r--backend/main.py8
3 files changed, 9 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..bec372b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.swp
+__pycache__
diff --git a/backend/config.py b/backend/config.py
new file mode 100644
index 0000000..6cfab69
--- /dev/null
+++ b/backend/config.py
@@ -0,0 +1 @@
+homepage = "https://stumpf.es/"
diff --git a/backend/main.py b/backend/main.py
index 1678f24..ff703be 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -1,8 +1,12 @@
import HTTP
import json
+import config
def playout(filename):
- return ["", [('Content-Type','text/html'), ('X-Accel-Redirect', filename)], None]
+ return ["", [('Content-Type','text/html'), ("X-Accel-Redirect", filename)], None]
+
+def home():
+ return ["", [('Content-Type','text/html'), ("Location", config.homepage)], "302 Home"]
def route(path, env, session, post):
if path[0] == "8cabc1fce52bcb565ae203267ce7e73f69a9272e":
@@ -11,7 +15,7 @@ def route(path, env, session, post):
return playout("interface/listing.htm")
# Default path
- return ["", [("Content-type", "text/html")], "404 None such"]
+ return home()
def handle_request(env, response):
path = env.get('PATH_INFO', '').lstrip('/').split('/')