From ea0229a8ab81cbe3ee588de84b3223a12d1a33ab Mon Sep 17 00:00:00 2001 From: Galonza Peter Date: Sun, 17 Oct 2021 23:37:45 +0300 Subject: [PATCH] added wsgi for gunicorn --- src/dashboard.py | 13 +++++++++++++ src/wsgi.py | 6 ++++++ 2 files changed, 19 insertions(+) create mode 100644 src/wsgi.py diff --git a/src/dashboard.py b/src/dashboard.py index 99a4c19..c073e35 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -1161,6 +1161,19 @@ def check_update(): else: return "true" +def run_wsgi(): + init_dashboard() + global config + config = configparser.ConfigParser(strict=False) + config.read('wg-dashboard.ini') + global app_ip + app_ip = config.get("Server", "app_ip") + global app_port + app_port = config.get("Server", "app_port") + global wg_conf_path + wg_conf_path = config.get("Server", "wg_conf_path") + config.clear() + return app if __name__ == "__main__": init_dashboard() diff --git a/src/wsgi.py b/src/wsgi.py new file mode 100644 index 0000000..97c15b1 --- /dev/null +++ b/src/wsgi.py @@ -0,0 +1,6 @@ +import dashboard + + +if __name__ in "__main__": + dashboard.run_wsgi() + dashboard.app.run()