From d9cd54695299e0fa81d65631ce876e9e8655a1a2 Mon Sep 17 00:00:00 2001 From: krateng Date: Wed, 17 Nov 2021 19:10:49 +0100 Subject: [PATCH] Moved main loop to function --- maloja/server.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/maloja/server.py b/maloja/server.py index 34dc4c9..241b1ba 100644 --- a/maloja/server.py +++ b/maloja/server.py @@ -39,10 +39,6 @@ from css_html_js_minify import html_minify, css_minify import urllib - - - - #settings.config(files=["settings/default.ini","settings/settings.ini"]) #settings.update("settings/default.ini","settings/settings.ini") MAIN_PORT = settings.get_settings("WEB_PORT") @@ -265,14 +261,17 @@ signal.signal(signal.SIGTERM, graceful_exit) #rename process, this is now required for the daemon manager to work setproctitle.setproctitle("Maloja") -## start database -database.start_db() +def run_server(): + ## start database + database.start_db() -log("Starting up Maloja server...") + log("Starting up Maloja server...") -try: - #run(webserver, host=HOST, port=MAIN_PORT, server='waitress') - waitress.serve(webserver, host=HOST, port=MAIN_PORT, threads=THREADS) -except OSError: - log("Error. Is another Maloja process already running?") - raise + try: + #run(webserver, host=HOST, port=MAIN_PORT, server='waitress') + waitress.serve(webserver, host=HOST, port=MAIN_PORT, threads=THREADS) + except OSError: + log("Error. Is another Maloja process already running?") + raise + +run_server()