From 0eaaca0383a8d2e2eb1d421640ce60cf85a91956 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Sat, 2 May 2020 20:31:52 -0700 Subject: [PATCH] Add default server for launching from gunicorn --- amanuensis/server/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/amanuensis/server/__init__.py b/amanuensis/server/__init__.py index 598798e..41fe451 100644 --- a/amanuensis/server/__init__.py +++ b/amanuensis/server/__init__.py @@ -1,6 +1,8 @@ +import os + from flask import Flask -from amanuensis.config import RootConfigDirectoryContext +from amanuensis.config import RootConfigDirectoryContext, ENV_CONFIG_DIR from amanuensis.models import ModelFactory from .auth import get_login_manager, bp_auth from .helpers import register_custom_filters @@ -35,3 +37,10 @@ def get_app(root: RootConfigDirectoryContext) -> Flask: app.register_blueprint(bp_session) return app + + +def default(): + cwd = os.getcwd() + config_dir = os.environ.get(ENV_CONFIG_DIR, "amanuensis") + root = RootConfigDirectoryContext(os.path.join(cwd, config_dir)) + return get_app(root)