You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
829 B
31 lines
829 B
import os
|
|
|
|
from flask import Flask
|
|
|
|
from atheneum.api import api_blueprint
|
|
|
|
|
|
def create_app(test_config=None):
|
|
app = Flask(__name__, instance_relative_config=True)
|
|
app.config.from_mapping(
|
|
SECRET_KEY='dev',
|
|
SQLALCHEMY_DATABASE_URI='sqlite:////tmp/test.db'
|
|
# SQLALCHEMY_DATABASE_URI=os.path.join(app.instance_path, 'atheneum.db')
|
|
)
|
|
|
|
if test_config is None:
|
|
app.config.from_object('atheneum.default_settings')
|
|
app.config.from_pyfile('config.py', silent=True)
|
|
if (os.getenv('ATHENEUM_SERVER_SETTINGS', None)):
|
|
app.config.from_envvar('ATHENEUM_SERVER_SETTINGS')
|
|
else:
|
|
app.config.from_pyfile(test_config)
|
|
|
|
try:
|
|
os.makedirs(app.instance_path)
|
|
except OSError:
|
|
pass
|
|
|
|
app.register_blueprint(api_blueprint)
|
|
|
|
return app
|