|
|
@ -5,7 +5,7 @@ from flask import Flask |
|
|
|
from flask_migrate import Migrate, upgrade |
|
|
|
from flask_sqlalchemy import SQLAlchemy |
|
|
|
|
|
|
|
from atheneum import utility |
|
|
|
from corvus import utility |
|
|
|
|
|
|
|
db: SQLAlchemy = SQLAlchemy() |
|
|
|
|
|
|
@ -28,12 +28,12 @@ dictConfig({ |
|
|
|
|
|
|
|
def create_app(test_config: dict = None) -> Flask: |
|
|
|
app = Flask(__name__, instance_relative_config=True) |
|
|
|
app.logger.debug('Creating Atheneum Server') |
|
|
|
app.logger.debug('Creating Corvus Server') |
|
|
|
|
|
|
|
data_directory = os.getenv('ATHENEUM_DATA_DIRECTORY', '/tmp') |
|
|
|
app.logger.debug('Atheneum Data Directory: %s', data_directory) |
|
|
|
data_directory = os.getenv('CORVUS_DATA_DIRECTORY', '/tmp') |
|
|
|
app.logger.debug('Corvus Data Directory: %s', data_directory) |
|
|
|
|
|
|
|
default_database_uri = 'sqlite:///{}/atheneum.db'.format(data_directory) |
|
|
|
default_database_uri = 'sqlite:///{}/corvus.db'.format(data_directory) |
|
|
|
app.config.from_mapping( |
|
|
|
SECRET_KEY='dev', |
|
|
|
SQLALCHEMY_DATABASE_URI=default_database_uri, |
|
|
@ -42,10 +42,10 @@ def create_app(test_config: dict = None) -> Flask: |
|
|
|
|
|
|
|
if test_config is None: |
|
|
|
app.logger.debug('Loading configurations') |
|
|
|
app.config.from_object('atheneum.default_settings') |
|
|
|
app.config.from_object('corvus.default_settings') |
|
|
|
app.config.from_pyfile('config.py', silent=True) |
|
|
|
if os.getenv('ATHENEUM_SETTINGS', None): |
|
|
|
app.config.from_envvar('ATHENEUM_SETTINGS') |
|
|
|
if os.getenv('CORVUS_SETTINGS', None): |
|
|
|
app.config.from_envvar('CORVUS_SETTINGS') |
|
|
|
else: |
|
|
|
app.logger.debug('Loading test configuration') |
|
|
|
app.config.from_object(test_config) |
|
|
@ -66,7 +66,7 @@ def create_app(test_config: dict = None) -> Flask: |
|
|
|
|
|
|
|
|
|
|
|
def register_blueprints(app: Flask) -> None: |
|
|
|
from atheneum.api import auth_blueprint |
|
|
|
from corvus.api import auth_blueprint |
|
|
|
app.register_blueprint(auth_blueprint) |
|
|
|
|
|
|
|
|