From dfa5a2dd198aa794eb6eab89730b1969c73bd5fc Mon Sep 17 00:00:00 2001 From: filakx Date: Fri, 25 Sep 2020 16:50:19 +0200 Subject: [PATCH] Version 1.4.1 --- flask-app/application/__init__.py | 2 +- flask-app/mtw-server.py | 8 +++++--- flask-app/mtw-worker.py | 9 ++++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/flask-app/application/__init__.py b/flask-app/application/__init__.py index 216d650..18275f2 100644 --- a/flask-app/application/__init__.py +++ b/flask-app/application/__init__.py @@ -46,7 +46,7 @@ def __call__(self, environ, start_response): app.config.update(dict( APP_NAME = 'MTW', - APP_VER = '1.4.0', + APP_VER = '1.4.1', API_VER = '1.0.0', DBVERSION = 1.0, TEMP_DIR = mtu.get_instance_dir(app, 'temp'), diff --git a/flask-app/mtw-server.py b/flask-app/mtw-server.py index 4fa5f71..d3a8745 100644 --- a/flask-app/mtw-server.py +++ b/flask-app/mtw-server.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +DEFAULT_HOST = '127.0.0.1' DEFAULT_PORT = 55930 DEFAULT_THREADS = 64 DEFAULT_CONFIG = 'conf/mtw-dist.ini' @@ -16,6 +17,7 @@ def main(): parser = argparse.ArgumentParser(description=appdesc, prog=appname, usage='%(prog)s [options]') parser.add_argument('--config', type=str, help='Config file path - default: '+DEFAULT_CONFIG, default=DEFAULT_CONFIG) + parser.add_argument('--host', type=str, help='Host - default: '+DEFAULT_HOST, default=DEFAULT_HOST) parser.add_argument('--port', type=int, help='Port number - default: '+str(DEFAULT_PORT), default=DEFAULT_PORT) parser.add_argument('--threads', type=int, help='Number of threads - default: '+str(DEFAULT_THREADS), default=DEFAULT_THREADS) parser.add_argument('--debug', help='Run in debug mode - DO NOT use in production !', action='store_true') @@ -36,12 +38,12 @@ def main(): app.template_folder = os.path.join(os.path.dirname(sys.executable), 'templates') try: - #serve(app, host='127.0.0.1', port=args.port, threads=args.threads) - serve(app, listen='127.0.0.1:'+str(args.port), threads=args.threads) + serve(app, host=args.host, port=args.port, threads=args.threads) + #serve(app, listen=args.host+':'+str(args.port), threads=args.threads) except: print('Server cannot be started - check/modify the args') if __name__ == "__main__": main() - + \ No newline at end of file diff --git a/flask-app/mtw-worker.py b/flask-app/mtw-worker.py index d8beb5f..51173dc 100644 --- a/flask-app/mtw-worker.py +++ b/flask-app/mtw-worker.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +DEFAULT_HOST = '127.0.0.1' DEFAULT_PORT = 55933 DEFAULT_THREADS = 64 DEFAULT_CONFIG = 'conf/mtw-dist.ini' @@ -16,8 +17,10 @@ def main(): parser = argparse.ArgumentParser(description=appdesc, prog=appname, usage='%(prog)s [options]') parser.add_argument('--config', type=str, help='Config file path - default: '+DEFAULT_CONFIG, default=DEFAULT_CONFIG) + parser.add_argument('--host', type=str, help='Host - default: '+DEFAULT_HOST, default=DEFAULT_HOST) parser.add_argument('--port', type=int, help='Port number - default: '+str(DEFAULT_PORT), default=DEFAULT_PORT) parser.add_argument('--threads', type=int, help='Number of threads - default: '+str(DEFAULT_THREADS), default=DEFAULT_THREADS) + parser.add_argument('--debug', help='Run in debug mode - DO NOT use in production !', action='store_true') args, unknown = parser.parse_known_args() @@ -28,15 +31,15 @@ def main(): logger = logging.getLogger('waitress') - app = create_app(debug=False, logger=logger, config_path=args.config) + app = create_app(debug=args.debug, logger=logger, config_path=args.config) if getattr(sys, 'frozen', False): app.static_folder = os.path.join(os.path.dirname(sys.executable), 'static') app.template_folder = os.path.join(os.path.dirname(sys.executable), 'templates') try: - #serve(app, host='127.0.0.1', port=args.port, threads=args.threads) - serve(app, listen='127.0.0.1:'+str(args.port), threads=args.threads) + serve(app, host=args.host, port=args.port, threads=args.threads) + #serve(app, listen=args.host+':'+str(args.port), threads=args.threads) except: print('Server cannot be started - check/modify the args')