51 lines
1.2 KiB
Batchfile
51 lines
1.2 KiB
Batchfile
@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
|
|
)
|