"""contracts-flask v2.0 — полный перенос с ВМ на Flask. Больше никаких прокси на contracts.kube5s.ru — всё локально. """ from flask import Flask from site.config import VERSION, MAX_CONTENT_LENGTH from site.routes import register_routes def create_app(): app = Flask(__name__) app.config["VERSION"] = VERSION app.config["MAX_CONTENT_LENGTH"] = MAX_CONTENT_LENGTH # DB auto-seed — schema migration + seed prompts + crash recovery _init_db() # Регистрация всех blueprint'ов register_routes(app) # no_cache на все ответы @app.after_request def no_cache(response): response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" response.headers["Pragma"] = "no-cache" response.headers["Expires"] = "0" return response return app def _init_db(): """Создать БД + схему + seed prompts. SQLite — всё в одном файле /tmp.""" from site.db.connection import init_db init_db() try: from site.db import prompts as db_prompts db_prompts.seed_defaults() except Exception: pass app = create_app()