-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactivation.bat
64 lines (52 loc) · 1.4 KB
/
activation.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
61
62
63
64
@echo off
echo Activating virtual environment...
:: Navigate to the directory containing your Flask application
cd /d C:\Users\antha\OneDrive\Desktop\foss hack
:: Verify the presence of app.py
if not exist "app.py" (
echo Error: app.py not found in the current directory.
pause
exit /b
)
:: Check if the venv directory exists
if not exist "venv\Scripts\activate.bat" (
echo Error: Virtual environment not found. Please create it first.
pause
exit /b
)
:: Add venv\Scripts to the PATH
set "PATH=%CD%\venv\Scripts;%PATH%"
:: Activate the virtual environment
:: call venv\Scripts\activate.bat
:: Verify activation
if "%errorlevel%" neq "0" (
echo Error: Could not activate the virtual environment.
pause
exit /b
)
:: Check if Flask is installed
pip show flask >nul 2>&1
if "%errorlevel%" neq "0" (
echo Error: Flask is not installed in the virtual environment.
echo Installing Flask...
pip install flask
if "%errorlevel%" neq "0" (
echo Error: Failed to install Flask.
pause
exit /b
)
)
:: Debugging Information
echo Virtual environment activated...
echo Setting environment variables...
:: Set environment variables
set "FLASK_APP=app.py"
set "FLASK_ENV=development"
:: Debugging Information
echo FLASK_APP=%FLASK_APP%
echo FLASK_ENV=%FLASK_ENV%
:: Run Flask
echo Running Flask...
flask run
:: Pause to keep the window open after execution
pause