An ebook/comic library service and web client
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.
 
 
 
 

43 lines
1.0 KiB

import os
from flask import Flask
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
db: SQLAlchemy = SQLAlchemy()
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/atheneum-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)
db.init_app(app)
migrate = Migrate(app, db)
return app
if __name__ == "__main__":
app = create_app()
app.run()