Skip to content

Commit

Permalink
Create deploy.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Oct 29, 2024
1 parent 2fcc394 commit a7d94fd
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# deploy.sh

set -e # Exit immediately if a command exits with a non-zero status

# Define variables
PROJECT_DIR=$(pwd)
VENV_DIR="$PROJECT_DIR/venv"
REQUIREMENTS_FILE="$PROJECT_DIR/requirements.txt"

# Create a virtual environment
if [ ! -d "$VENV_DIR" ]; then
echo "Creating virtual environment..."
python3 -m venv "$VENV_DIR"
fi

# Activate the virtual environment
echo "Activating virtual environment..."
source "$VENV_DIR/bin/activate"

# Install dependencies
echo "Installing dependencies from $REQUIREMENTS_FILE..."
pip install -r "$REQUIREMENTS_FILE"

# Run database migrations (if applicable)
# Uncomment the following line if using a database with migrations
# echo "Running database migrations..."
# python manage.py migrate

echo "Deployment completed successfully!"

0 comments on commit a7d94fd

Please sign in to comment.