From 60633bbc496e26075d8ef1a4723673f48ec13749 Mon Sep 17 00:00:00 2001 From: Ralf Ramsauer Date: Wed, 5 Sep 2018 21:14:28 +0000 Subject: [PATCH] Flask: specify correct root_path We need that for package installation. Signed-off-by: Ralf Ramsauer --- doorlockd | 10 ++++++++-- {static => share/doorlockd/static}/led-green.png | Bin {static => share/doorlockd/static}/led-red.png | Bin {static => share/doorlockd/static}/led-yellow.png | Bin {static => share/doorlockd/static}/logo.svg | 0 .../doorlockd/static}/socket.io.slim.js | 0 {static => share/doorlockd/static}/token.png | Bin .../doorlockd/templates}/display.html | 0 {templates => share/doorlockd/templates}/index.html | 0 .../doorlockd/templates}/layout.html | 0 10 files changed, 8 insertions(+), 2 deletions(-) rename {static => share/doorlockd/static}/led-green.png (100%) rename {static => share/doorlockd/static}/led-red.png (100%) rename {static => share/doorlockd/static}/led-yellow.png (100%) rename {static => share/doorlockd/static}/logo.svg (100%) rename {static => share/doorlockd/static}/socket.io.slim.js (100%) rename {static => share/doorlockd/static}/token.png (100%) rename {templates => share/doorlockd/templates}/display.html (100%) rename {templates => share/doorlockd/templates}/index.html (100%) rename {templates => share/doorlockd/templates}/layout.html (100%) diff --git a/doorlockd b/doorlockd index dbb6a73..4e0d210 100755 --- a/doorlockd +++ b/doorlockd @@ -41,6 +41,10 @@ PREFIX = '.' root_prefix = join(PREFIX, 'share', 'doorlockd') sounds_prefix = join(root_prefix, 'sounds') +static_folder = join(root_prefix, 'static') +template_folder = join(root_prefix, 'templates') + +flask_config = join(SYSCONFDIR, 'doorlockd.cfg') __author__ = 'Ralf Ramsauer' __copyright = 'Copyright (c) Ralf Ramsauer, 2018' @@ -62,8 +66,10 @@ default_binddn = 'cn=%s,ou=people,dc=binary-kitchen,dc=de' html_title = 'Binary Kitchen Doorlock (%s - v%s)' % (__status__, __version__) -webapp = Flask(__name__) -webapp.config.from_pyfile(join(SYSCONFDIR, 'doorlockd.cfg')) +webapp = Flask(__name__, + template_folder=template_folder, + static_folder=static_folder) +webapp.config.from_pyfile(flask_config) socketio = SocketIO(webapp, async_mode='threading') Bootstrap(webapp) serial_port = webapp.config.get('SERIAL_PORT') diff --git a/static/led-green.png b/share/doorlockd/static/led-green.png similarity index 100% rename from static/led-green.png rename to share/doorlockd/static/led-green.png diff --git a/static/led-red.png b/share/doorlockd/static/led-red.png similarity index 100% rename from static/led-red.png rename to share/doorlockd/static/led-red.png diff --git a/static/led-yellow.png b/share/doorlockd/static/led-yellow.png similarity index 100% rename from static/led-yellow.png rename to share/doorlockd/static/led-yellow.png diff --git a/static/logo.svg b/share/doorlockd/static/logo.svg similarity index 100% rename from static/logo.svg rename to share/doorlockd/static/logo.svg diff --git a/static/socket.io.slim.js b/share/doorlockd/static/socket.io.slim.js similarity index 100% rename from static/socket.io.slim.js rename to share/doorlockd/static/socket.io.slim.js diff --git a/static/token.png b/share/doorlockd/static/token.png similarity index 100% rename from static/token.png rename to share/doorlockd/static/token.png diff --git a/templates/display.html b/share/doorlockd/templates/display.html similarity index 100% rename from templates/display.html rename to share/doorlockd/templates/display.html diff --git a/templates/index.html b/share/doorlockd/templates/index.html similarity index 100% rename from templates/index.html rename to share/doorlockd/templates/index.html diff --git a/templates/layout.html b/share/doorlockd/templates/layout.html similarity index 100% rename from templates/layout.html rename to share/doorlockd/templates/layout.html