-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_env.sh
More file actions
70 lines (60 loc) · 2.11 KB
/
setup_env.sh
File metadata and controls
70 lines (60 loc) · 2.11 KB
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
65
66
67
68
69
70
#!/bin/bash
# Setup script for Documentation.AI
echo "🚀 Setting up Documentation.AI Environment"
# Check if we're in the right directory
if [ ! -f "app.py" ]; then
echo "❌ Error: app.py not found. Please run this from the Documentation.AI directory."
exit 1
fi
# Create virtual environment if it doesn't exist
if [ ! -d ".venv" ]; then
echo "📦 Creating virtual environment..."
python3 -m venv .venv
if [ $? -ne 0 ]; then
echo "❌ Failed to create virtual environment"
echo "💡 Make sure Python 3 is installed: brew install python3"
exit 1
fi
echo "✅ Virtual environment created"
fi
# Activate virtual environment
echo "🔧 Activating virtual environment..."
source .venv/bin/activate
# Upgrade pip
echo "📦 Upgrading pip..."
pip install --upgrade pip
# Install essential Flask dependencies
echo "📦 Installing Flask dependencies..."
pip install flask==2.3.3 flask-cors==4.0.0 flask-sqlalchemy==3.0.5 python-dotenv==1.0.0 requests==2.31.0
# Test Flask installation
echo "🧪 Testing Flask installation..."
python -c "import flask; print('✅ Flask version:', flask.__version__)"
if [ $? -ne 0 ]; then
echo "❌ Flask installation failed"
exit 1
fi
# Test app import
echo "🧪 Testing app import..."
python -c "from app import app; print('✅ App imports successfully')"
if [ $? -ne 0 ]; then
echo "❌ App import failed, but Flask is installed"
echo "💡 This might be due to missing optional dependencies"
echo "📦 Installing additional dependencies..."
pip install gitpython markdown beautifulsoup4
# Try again
python -c "from app import app; print('✅ App imports successfully')"
if [ $? -ne 0 ]; then
echo "⚠️ App import still failing - check for missing dependencies"
echo "🔍 Try running: source .venv/bin/activate && python app.py"
fi
fi
echo ""
echo "✅ Setup complete!"
echo ""
echo "To use the environment:"
echo " source .venv/bin/activate"
echo " python app.py"
echo ""
echo "To install additional dependencies:"
echo " source .venv/bin/activate"
echo " pip install -r requirements.txt"