fix: direct imports (no site. prefix, no relative) — works with python site/app.py
Deploy contracts-flask / validate (push) Successful in 0s
Deploy contracts-flask / validate (push) Successful in 0s
This commit is contained in:
+8
-8
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user