summaryrefslogtreecommitdiffstats
path: root/dashboard/backend/wsgi.py
diff options
context:
space:
mode:
authorLeo Wang <grakiss.wanglei@huawei.com>2016-11-16 22:44:23 -0500
committerLeo Wang <grakiss.wanglei@huawei.com>2016-11-20 23:00:24 -0500
commit68fde29bdcfe0b206f588dab85e5b7d8ac9449f4 (patch)
tree833c95a1af1379a011d8c64728369718fe8edbdd /dashboard/backend/wsgi.py
parent8a6bc92ff3b906a72194c7fa5db61ebb030052a4 (diff)
Backend rest api mechanism
JIRA:DOVETAIL-63 provide rest api as the dashboard backend 1. using gunicorn as rest api server 2. using flask as rest api framework 3. using sqlalchemy as mysql database driver 4. implement basic report CRUD operations 5. implement basic session management in database operations Change-Id: Ifbd251462396c2cb414b1ae9150cfc1e2e2d00c0 Signed-off-by: Leo Wang <grakiss.wanglei@huawei.com>
Diffstat (limited to 'dashboard/backend/wsgi.py')
-rwxr-xr-xdashboard/backend/wsgi.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/dashboard/backend/wsgi.py b/dashboard/backend/wsgi.py
new file mode 100755
index 00000000..088299d7
--- /dev/null
+++ b/dashboard/backend/wsgi.py
@@ -0,0 +1,35 @@
+##############################################################################
+# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+from dovetail.utils import flags
+from dovetail.utils import logsetting
+from dovetail.utils import setting_wrapper as setting
+
+from dovetail.api.api import app
+
+import os
+import logging
+
+gunicorn_error_logger = logging.getLogger('gunicorn.error')
+app.logger.handlers.extend(gunicorn_error_logger.handlers)
+app.logger.setLevel(logging.DEBUG)
+
+# flags.init()
+# logdir = setting.DEFAULT_LOGDIR
+curr_path = os.path.dirname(os.path.abspath(__file__))
+logdir = os.path.join(curr_path, 'log')
+if not os.path.exists(logdir):
+ os.makedirs(logdir)
+
+flags.OPTIONS.logdir = logdir
+flags.OPTIONS.logfile = setting.WEB_LOGFILE
+logsetting.init()
+
+
+if __name__ == "__main__":
+ app.run()