Fix init-only mode for PostgreSQL deploy script imports.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-01 08:14:43 +08:00
parent a1f22624de
commit 008f042fcc
2 changed files with 17 additions and 16 deletions
+15 -15
View File
@@ -543,7 +543,8 @@ def sync_ths_token():
set_ths_refresh_token(get_setting("ths_refresh_token"))
sync_ths_token()
if os.getenv("QIHUO_INIT_ONLY") != "1":
sync_ths_token()
def build_market_quote_payload(
@@ -2224,20 +2225,19 @@ def settings():
)
install_trading(
app,
login_required=login_required,
require_nav=require_nav,
get_db=get_db,
get_setting=get_setting,
set_setting=set_setting,
fetch_price=fetch_price,
send_wechat_msg=send_wechat_msg,
)
try_init_vnpy({})
start_background_threads()
if os.getenv("QIHUO_INIT_ONLY") != "1":
install_trading(
app,
login_required=login_required,
require_nav=require_nav,
get_db=get_db,
get_setting=get_setting,
set_setting=set_setting,
fetch_price=fetch_price,
send_wechat_msg=send_wechat_msg,
)
try_init_vnpy({})
start_background_threads()
# —————————————— 启动 ——————————————
+2 -1
View File
@@ -79,8 +79,9 @@ echo "==> 初始化 PostgreSQL 表结构..."
cd "$APP_DIR"
export DATABASE_URL
export QIHUO_SKIP_INIT_DB=1
export QIHUO_INIT_ONLY=1
python3 -c "from app import init_db; init_db(); from db_conn import database_label; print('OK:', database_label())"
unset QIHUO_SKIP_INIT_DB
unset QIHUO_SKIP_INIT_DB QIHUO_INIT_ONLY
if [ "$MIGRATE_SQLITE" = "1" ] && [ -f "$APP_DIR/futures.db" ]; then
echo "==> 从 SQLite 迁移数据..."