From 7cdad101012a903301a2d79643c80afdf22edb6f Mon Sep 17 00:00:00 2001 From: jessikitty Date: Fri, 12 Dec 2025 10:14:34 +1100 Subject: [PATCH] Add startup batch file for automatic LEGO Instructions Manager startup --- start_lim.bat | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 start_lim.bat diff --git a/start_lim.bat b/start_lim.bat new file mode 100644 index 0000000..faf574f --- /dev/null +++ b/start_lim.bat @@ -0,0 +1,50 @@ +@echo off +echo Starting LEGO Instructions Manager... +cd /d E:\LIM + +REM Check if virtual environment exists +if not exist "venv\" ( + echo Creating virtual environment... + python -m venv venv + if errorlevel 1 ( + echo Failed to create virtual environment + pause + exit /b 1 + ) +) + +REM Activate virtual environment +echo Activating virtual environment... +call venv\Scripts\activate.bat +if errorlevel 1 ( + echo Failed to activate virtual environment + pause + exit /b 1 +) + +REM Install/update requirements if requirements.txt exists +if exist "requirements.txt" ( + echo Installing/updating dependencies... + pip install -r requirements.txt + if errorlevel 1 ( + echo Failed to install dependencies + pause + exit /b 1 + ) +) + +REM Initialize database if needed +if not exist "instance\lego_instructions.db" ( + echo Initializing database... + python -c "from app import create_app, db; app = create_app(); app.app_context().push(); db.create_all()" +) + +REM Start the application +echo Starting Flask application... +python run.py + +REM Keep window open if there's an error +if errorlevel 1 ( + echo Application stopped with an error + pause +)