29 lines
575 B
Python

from flask import Flask
from .config import Config
from .db import db
from .models import init_schedule_config
from .blueprints import register_blueprints
def create_app(test_config=None):
app = Flask(__name__)
app.config.from_object(Config)
if test_config:
app.config.update(test_config)
db.init_app(app)
with app.app_context():
db.create_all()
init_schedule_config()
@app.context_processor
def inject_app_title():
return {"app_title": app.config["APP_TITLE"]}
register_blueprints(app)
return app