1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-12-22 10:24:26 +01:00

pydoorlock: Condense locality of Flask stuff

Signed-off-by: Ralf Ramsauer <ralf@binary-kitchen.de>
This commit is contained in:
Ralf Ramsauer 2018-10-08 02:49:16 +02:00
parent badeb1945b
commit 2cdf9d1b27

View File

@ -60,9 +60,7 @@ date_fmt = '%Y-%m-%d %H:%M:%S'
log_fmt = '%(asctime)-15s %(levelname)-8s %(message)s'
log = logging.getLogger()
webapp = Flask(__name__,
template_folder=template_folder,
static_folder=static_folder)
webapp = Flask(__name__)
socketio = SocketIO(webapp, async_mode='threading')
class Config:
@ -92,9 +90,6 @@ room = cfg.str('ROOM')
title = cfg.str('TITLE')
welcome = cfg.str('WELCOME')
webapp.config['SECRET_KEY'] = cfg.str('SECRET_KEY')
html_title = '%s (%s - v%s)' % (title, __status__, __version__)
wave_emergency = 'emergency_unlock.wav'
@ -111,11 +106,6 @@ wave_unlock_button = 'unlock_button.wav'
wave_zonk = 'zonk.wav'
host = 'localhost'
if debug:
host = '0.0.0.0'
def playsound(filename):
if not sounds:
return
@ -421,6 +411,13 @@ if __name__ == '__main__':
logic = Logic()
host = 'localhost'
if debug:
host = '0.0.0.0'
webapp.config['SECRET_KEY'] = cfg.str('SECRET_KEY')
webapp.template_folder=template_folder
webapp.static_folder=static_folder
socketio.run(webapp, host=host, port=8080, use_reloader=False, debug=debug)
sys.exit(0)