diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..cc9dc70 --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +VERSION ?= $(shell git rev-parse --short HEAD) + +release: door_admin_v$(VERSION).tar.gz + +TEMPLATE_FILES = $(shell find -name '*.html') +STATIC_FILES = $(shell find -name '*.png' -o -name '*.js') +PYTHON_FILES = $(shell find -name '*.py') +ALL_FILES = $(TEMPLATE_FILES) $(STATIC_FILES) $(PYTHON_FILES) + +door_admin_v$(VERSION).tar.gz: Makefile $(ALL_FILES) + tar czf $@ --transform='s,^,door_admin_$(VERSION)/,' $^ + +install: install_templates install_static install_python + +install_static: + install -D -m 0755 -t $(PREFIX)/usr/share/door_admin/static $(STATIC_FILES) + +install_templates: + install -D -m 0755 -t $(PREFIX)/usr/share/door_admin/templates $(TEMPLATE_FILES) + +install_python: + install -D -m 0755 -t $(PREFIX)/bin $(PYTHON_FILES) + +.PHONY: release install install_static install_templates install_python diff --git a/app.py b/app.py index 2f73ee6..f17f146 100644 --- a/app.py +++ b/app.py @@ -16,7 +16,7 @@ MQTT_BROKER = '10.10.21.2' door = DoorHandle(MQTT_BROKER) -app = Flask(__name__) +app = Flask(__name__, template_folder='/usr/share/door_admin/templates', static_url_path='/usr/share/door_admin/static') # Generate a nice key using secrets.token_urlsafe() app.config['SECRET_KEY'] = os.environ.get("SECRET_KEY", 'Q7PJu2fg2jabYwP-Psop6c6f2G4')