From 05f2ee416eb6bea1a41fe26691491c9af6c0d990 Mon Sep 17 00:00:00 2001 From: Jayway Liu <14022498+bluejayway@user.noreply.gitee.com> Date: Sat, 26 Sep 2026 20:45:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(dev):=20dev=5Fup=20=E4=BB=A5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E4=B8=BA=E5=87=86=E5=B9=82=E7=AD=89=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E7=AE=A1=E7=90=86=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 此前凭据文件存在但数据库重建时会跳过 init_local.py,导致本地无 admin 无法登录;改为每次启动都执行(脚本本身按数据库幂等)。 --- scripts/dev_up.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/dev_up.sh b/scripts/dev_up.sh index f8d763d..1c3d682 100755 --- a/scripts/dev_up.sh +++ b/scripts/dev_up.sh @@ -74,10 +74,9 @@ fi echo "执行数据库迁移…" $PY manage.py migrate --no-input >/dev/null -if [ ! -f var/local-access.txt ]; then - echo "初始化本地管理员…" - PYTHONPATH="$ROOT" $PY scripts/init_local.py -fi +# init_local.py 以数据库为准幂等执行:缺 admin 时创建并写凭据文件,已存在则跳过 +echo "初始化本地管理员(已存在则跳过)…" +PYTHONPATH="$ROOT" $PY scripts/init_local.py if [ ! -d frontend/dist ]; then echo "构建前端(首次)…"