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