Fix init-only mode for PostgreSQL deploy script imports.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -543,7 +543,8 @@ def sync_ths_token():
|
|||||||
set_ths_refresh_token(get_setting("ths_refresh_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(
|
def build_market_quote_payload(
|
||||||
@@ -2224,7 +2225,8 @@ def settings():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
install_trading(
|
if os.getenv("QIHUO_INIT_ONLY") != "1":
|
||||||
|
install_trading(
|
||||||
app,
|
app,
|
||||||
login_required=login_required,
|
login_required=login_required,
|
||||||
require_nav=require_nav,
|
require_nav=require_nav,
|
||||||
@@ -2233,11 +2235,9 @@ install_trading(
|
|||||||
set_setting=set_setting,
|
set_setting=set_setting,
|
||||||
fetch_price=fetch_price,
|
fetch_price=fetch_price,
|
||||||
send_wechat_msg=send_wechat_msg,
|
send_wechat_msg=send_wechat_msg,
|
||||||
)
|
)
|
||||||
|
try_init_vnpy({})
|
||||||
try_init_vnpy({})
|
start_background_threads()
|
||||||
|
|
||||||
start_background_threads()
|
|
||||||
|
|
||||||
# —————————————— 启动 ——————————————
|
# —————————————— 启动 ——————————————
|
||||||
|
|
||||||
|
|||||||
@@ -79,8 +79,9 @@ echo "==> 初始化 PostgreSQL 表结构..."
|
|||||||
cd "$APP_DIR"
|
cd "$APP_DIR"
|
||||||
export DATABASE_URL
|
export DATABASE_URL
|
||||||
export QIHUO_SKIP_INIT_DB=1
|
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())"
|
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
|
if [ "$MIGRATE_SQLITE" = "1" ] && [ -f "$APP_DIR/futures.db" ]; then
|
||||||
echo "==> 从 SQLite 迁移数据..."
|
echo "==> 从 SQLite 迁移数据..."
|
||||||
|
|||||||
Reference in New Issue
Block a user