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