djangotutorial/scripts/setup_env.sh

30 lines
853 B
Bash

#!/bin/bash
# Exit immediately if a command exits with a non-zero status.
set -e
# Create the virtual environment in the current directory
echo "Checking to see if virtual environment exists..."
if [ -d .venv ]; then
# echo "Virtual environment already exists. Please delete it before running this script."
# exit 1
echo "Virtual environment already exists. Skipping creation."
else
echo "Virtual environment does not exist. Creating..."
python3.12 -m venv .venv
echo "Virtual environment created."
fi
# python -m venv .venv
# Activate the virtual environment
source .venv/bin/activate
# Install the required packages from the requirements.txt file
pip install -r requirements.txt
# Upgrade pip
pip install --upgrade pip
# Print a success message
echo "Virtual environment created and requirements installed successfully."