Skip to content
Snippets Groups Projects
Commit 9a0b3b63 authored by David Trattnig's avatar David Trattnig
Browse files

Chore: Make debugable by using default name "app"

parent 53cf4e70
No related branches found
No related tags found
No related merge requests found
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
import atexit import atexit
import sys
import os import os
import sys
import connexion import connexion
from aura_engine_api.base.config import AuraConfig from aura_engine_api.base.config import AuraConfig
...@@ -53,16 +54,19 @@ def build_app(app): ...@@ -53,16 +54,19 @@ def build_app(app):
app.config["FLASK_ENV"] = "development" app.config["FLASK_ENV"] = "development"
if config.get("debug_flask") == "true": if config.get("debug_flask") == "true":
app.config["DEBUG"] = True app.config["DEBUG"] = True
#os.environ["FLASK_DEBUG"] = "1"
#os.environ["FLASK_ENV"] = "development"
db.init_app(app) db.init_app(app)
ma.init_app(app) ma.init_app(app)
return app return app
api = connexion.App( app = connexion.App(
__name__, specification_dir="rest/swagger", arguments={"title": "AURA Engine API"} __name__, specification_dir="rest/swagger", arguments={"title": "AURA Engine API"}
) )
api.add_api("swagger.yaml", pythonic_params=True) app.add_api("swagger.yaml", pythonic_params=True)
app = build_app(api.app) app = build_app(app.app)
@app.after_request @app.after_request
...@@ -71,12 +75,14 @@ def after_request(response): ...@@ -71,12 +75,14 @@ def after_request(response):
header["Access-Control-Allow-Origin"] = config.get("api_cors") header["Access-Control-Allow-Origin"] = config.get("api_cors")
return response return response
def startup(): def startup():
""" """
Startup Server. Startup Server.
""" """
port = config.get("api_port") port = config.get("api_port")
api.run(port=port) app.run(port=port)
def shutdown(): def shutdown():
""" """
...@@ -85,8 +91,9 @@ def shutdown(): ...@@ -85,8 +91,9 @@ def shutdown():
if sync_job: if sync_job:
sync_job.exit() sync_job.exit()
def get_version(): def get_version():
with open(os.path.join("", 'VERSION')) as version_file: with open(os.path.join("", "VERSION")) as version_file:
return version_file.read().strip() return version_file.read().strip()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment