from flask import Flask import os def create_app(): app = Flask(__name__) app.config["DB_PATH"] = "data/db/db.sqlite" os.makedirs(os.path.dirname(app.config["DB_PATH"]), exist_ok = True) with app.app_context(): from .schema import create as create_tables from .migrations import run_migrations create_tables() run_migrations() if os.getenv("PYROM_PROD") is None: app.static_folder = os.path.join(os.path.dirname(__file__), "../data/static") app.debug = True from app.routes.app import bp as app_bp app.register_blueprint(app_bp) return app