adding vth code as well as aaf and cert config
[it/otf.git] / otf-robot-test-head / app / __init__.py
1 """ Copyright (c) 2019 AT&T Intellectual Property.                             #\r
2 #                                                                              #\r
3 #   Licensed under the Apache License, Version 2.0 (the "License");            #\r
4 #   you may not use this file except in compliance with the License.           #\r
5 #   You may obtain a copy of the License at                                    #\r
6 #                                                                              #\r
7 #       http://www.apache.org/licenses/LICENSE-2.0                             #\r
8 #                                                                              #\r
9 #   Unless required by applicable law or agreed to in writing, software        #\r
10 #   distributed under the License is distributed on an "AS IS" BASIS,          #\r
11 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #\r
12 #   See the License for the specific language governing permissions and        #\r
13 #   limitations under the License.                                             #\r
14 #############################################################################"""\r
15 \r
16 \r
17 from flask import Flask\r
18 from app.routes import *\r
19 from app import database\r
20 \r
21 \r
22 def create_app():\r
23     # create Flask application\r
24     app = Flask(__name__)\r
25 \r
26     # apply configuration\r
27     app.config.from_object(os.environ['APP_SETTINGS'])\r
28     app.config['g_database'] = None\r
29     app.config['g_base_folder'] = os.path.join(os.getcwd(), 'files')\r
30     app.config['g_data_folder'] = os.path.join(app.config['g_base_folder'], 'data')\r
31     app.config['g_working_folder'] = os.path.join(app.config['g_base_folder'], 'results')\r
32 \r
33     # register all routes on the APPLICATION_ROOT\r
34     app.register_blueprint(routes, url_prefix=app.config['APPLICATION_ROOT'])\r
35 \r
36     return app\r