diff --git a/fuji_server/__main__.py b/fuji_server/__main__.py index 2e291cba..ff87c7ef 100644 --- a/fuji_server/__main__.py +++ b/fuji_server/__main__.py @@ -31,7 +31,7 @@ from flask_limiter.util import get_remote_address from waitress import serve -from fuji_server.app.fuji_app import create_fuji_app +from fuji_server.app.fuji_app import create_app from fuji_server.helper.preprocessor import Preprocessor @@ -74,7 +74,7 @@ def main(): logger.info(f"Total LD vocabs imported : {len(preproc.getLinkedVocabs())}") logger.info(f"Total default namespaces specified : {len(preproc.getDefaultNamespaces())}") - app = create_fuji_app(config) + app = create_app(config) Limiter(get_remote_address, app=app.app, default_limits=[str(config["SERVICE"]["rate_limit"])]) # comment in case waitress is wished # app.run(host=config['SERVICE']['service_host'], port=int(config['SERVICE']['service_port']),debug=False) diff --git a/fuji_server/app.py b/fuji_server/app.py index 2813f2e4..6a1bce69 100644 --- a/fuji_server/app.py +++ b/fuji_server/app.py @@ -30,16 +30,16 @@ from fuji_server import encoder -def create_fuji_app(config): +def create_app(config): """ Function which initializes the FUJI connexion flask app and returns it """ # you can also use Tornado or gevent as the HTTP server, to do so set server to tornado or gevent - ROOT_DIR = Path(__file__).parent.parent + ROOT_DIR = Path(__file__).parent YAML_DIR = config["SERVICE"]["yaml_directory"] app = connexion.FlaskApp(__name__, specification_dir=YAML_DIR) - API_YAML = os.path.join(ROOT_DIR, YAML_DIR, config["SERVICE"]["openapi_yaml"]) + API_YAML = ROOT_DIR.joinpath(YAML_DIR, config["SERVICE"]["openapi_yaml"]) app.app.json_encoder = encoder.JSONEncoder app.add_api(API_YAML, validate_responses=True)