fix: direct imports (no site. prefix, no relative) — works with python site/app.py
Deploy contracts-flask / validate (push) Successful in 0s

This commit is contained in:
2026-07-15 11:37:57 +04:00
parent 15137f8e94
commit f9669755cd
18 changed files with 61 additions and 61 deletions
+8 -8
View File
@@ -1,9 +1,13 @@
"""contracts-flask v2.0 — полный перенос с ВМ на Flask.
Больше никаких прокси на contracts.kube5s.ru — всё локально.
"""
import sys, os
# site/ в sys.path — импортируем модули напрямую, без префиксов
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from flask import Flask
from .config import VERSION, MAX_CONTENT_LENGTH
from .routes import register_routes
from config import VERSION, MAX_CONTENT_LENGTH
from routes import register_routes
def create_app():
@@ -11,13 +15,9 @@ def create_app():
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"
@@ -30,10 +30,10 @@ def create_app():
def _init_db():
"""Создать БД + схему + seed prompts. SQLite — всё в одном файле /tmp."""
from .db.connection import init_db
from db.connection import init_db
init_db()
try:
from .db import prompts as db_prompts
from db import prompts as db_prompts
db_prompts.seed_defaults()
except Exception:
pass