-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.bat
60 lines (56 loc) · 1.67 KB
/
install.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@echo off
echo Installation of required packages...
set /p decide=Skip package installation? (yes/no):
if "%decide%"=="no" (
echo Installing packages ...
pip install -r requirements.txt
) else (
echo Starting Migration phase ...
)
if errorlevel 1 (
exit /b 0
)
set migrationsPath=migrations
if exist %migrationsPath% (
echo Migrations already exist, trying to migrate and upgrade ...
set /p decide=Create new database? (yes/no):
if "%decide%"=="yes" (
python -m flask db migrate
if errorlevel 1 (
echo status - 1, could not migrate database, creating new migrations ...
rmdir /s /q %migrationsPath%
python -m flask db init
python -m flask db migrate
echo Database set up successful
) else (
python -m flask db upgrade
echo Database set up successful
)
) elseif "%decide%"=="no" (
set /p decide=Start Server on development? (yes/no):
if "%decide%"=="yes" (
python -m flask run
) elseif "%decide%"=="no" (
echo Exiting...
exit /b 0
) else (
echo Invalid input. Please enter 'yes' or 'no'.
)
) else (
echo Invalid input. Please enter 'yes' or 'no'.
)
) else (
echo Migrations do not exist, creating new one
python -m flask db init
python -m flask db migrate
python -m flask db upgrade
)
set /p decide=Start Server on development? (yes/no):
if "%decide%"=="yes" (
python server.py
) elseif "%decide%"=="no" (
echo Exiting...
exit /b 0
) else (
echo Invalid input. Please enter 'yes' or 'no'.
)