Python venv (virtural environment) comes package with Python 3.
-
Execute the following command to create a virtual environment
# Creates venv folder in the current directory $ python -m venv venv
REM Creates venv folder in the current directory > py -3 -m venv venv
-
Startup your virtual environment:
# Makes venv the default Python interpreter $ . venv/bin/activate # OR $ source venv/bin/activate
REM Makes venv the default Python interpreter $ .\venv\Scripts\activate.bat
-
Shutting down virtual environment
# Turns of venv $ deactivate
REM Turns of venv $ .\venv\Scripts\deactivate.bat
-
Install python dependencies
While venv is activated execute the following command
# Install all application libraries $ pip install -r requirements.txt
REM Install all application libraries > pip install -r requirements.txt
-
Start flask application
$ venv/bin/flask run --no-debugger
your
.flaskenv
file will have to look likeFLASK_APP=app.py FLASK_ENV=development