Skip to content

Commit 024bc12

Browse files
authored
Merge pull request #53 from manavgup/fix/run-gunicorn
fix: update run-gunicorn.sh script to activate virtual env if not already active
2 parents d0e63be + fc27cb7 commit 024bc12

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

run-gunicorn.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22
# Author: Mihai Criveti
33
# Description: Run Gunicorn production server (optionally with TLS)
44

5+
# Determine script directory
6+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7+
8+
# Attempt to activate a venv if not already active
9+
if [[ -z "$VIRTUAL_ENV" ]]; then
10+
# If a known venv path exists (like your custom .venv location), activate it
11+
if [[ -f "${HOME}/.venv/mcpgateway/bin/activate" ]]; then
12+
echo "🔧 Activating virtual environment: ${HOME}/.venv/mcpgateway"
13+
source "${HOME}/.venv/mcpgateway/bin/activate"
14+
elif [[ -f "${SCRIPT_DIR}/.venv/bin/activate" ]]; then
15+
echo "🔧 Activating virtual environment in script directory"
16+
source "${SCRIPT_DIR}/.venv/bin/activate"
17+
else
18+
echo "⚠️ No virtual environment found! Please activate manually."
19+
exit 1
20+
fi
21+
fi
22+
523
cat << "EOF"
624
███╗ ███╗ ██████╗██████╗ ██████╗ █████╗ ████████╗███████╗██╗ ██╗ █████╗ ██╗ ██╗
725
████╗ ████║██╔════╝██╔══██╗ ██╔════╝ ██╔══██╗╚══██╔══╝██╔════╝██║ ██║██╔══██╗╚██╗ ██╔╝

0 commit comments

Comments
 (0)