diff --git a/default.nix b/default.nix
index f912207..a7554b9 100644
--- a/default.nix
+++ b/default.nix
@@ -3,6 +3,6 @@ with python3.pkgs;
buildPythonPackage rec {
name = "mqtt-dash";
src = ./.;
- propagatedBuildInputs = [ flask ];
+ propagatedBuildInputs = [ flask setuptools ];
doCheck = false;
}
diff --git a/make-static-site b/make-static-site
new file mode 100755
index 0000000..88e5f6f
--- /dev/null
+++ b/make-static-site
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+
+import argparse
+import os
+import sys
+import pkg_resources
+import shutil
+
+import mqtt_dash.app
+from mqtt_dash.app import app
+
+args = argparse.ArgumentParser()
+
+args.add_argument('config', default='config.py', help='Configuration file')
+
+options = args.parse_args()
+
+app.secret_key = os.urandom(12)
+app.config.from_pyfile(os.path.abspath(options.config))
+
+
+missing_config_fields = False
+for opt in ('URL', 'MQTT_BROKER', 'PAGE_TITLE', 'WIDGETS'):
+ if opt not in app.config:
+ print(f'Error: field {opt} missing in configuration')
+ missing_config_fields = True
+if missing_config_fields:
+ sys.exit(1)
+
+
+client = app.test_client()
+r = client.get('/')
+with open("index.html", "wb") as f:
+ f.write(r.data)
+
+static_assets = pkg_resources.resource_filename('mqtt_dash', 'static')
+shutil.copytree(static_assets, "static")
+
diff --git a/mqtt_dash/templates/base.html b/mqtt_dash/templates/base.html
index f8cea7d..b645f11 100644
--- a/mqtt_dash/templates/base.html
+++ b/mqtt_dash/templates/base.html
@@ -5,10 +5,10 @@
-
+
-
+