-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·88 lines (72 loc) · 2.27 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·88 lines (72 loc) · 2.27 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
# Musculation Program Generator - Deployment Script
# This script sets up and runs the application
echo "🚀 Musculation Program Generator - Setup & Launch"
echo "=================================================="
# Check if Python is available
if ! command -v python3 &> /dev/null; then
echo "❌ Python 3 is required but not installed."
echo " Please install Python 3.8 or higher"
exit 1
fi
# Check if we're in the right directory
if [ ! -f "app.py" ]; then
echo "❌ Please run this script from the project directory"
echo " Make sure app.py is in the current directory"
exit 1
fi
echo "✅ Python 3 found"
echo "✅ Project files detected"
# 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"
exit 1
fi
echo "✅ Virtual environment created"
fi
# Activate virtual environment
echo "🔄 Activating virtual environment..."
source .venv/bin/activate
# Install/upgrade dependencies
echo "📥 Installing dependencies..."
pip install --upgrade pip
pip install -r requirements.txt
if [ $? -ne 0 ]; then
echo "❌ Failed to install dependencies"
echo " Please check requirements.txt and your internet connection"
exit 1
fi
echo "✅ Dependencies installed successfully"
# Check for available port
PORT=5000
while lsof -Pi :$PORT -sTCP:LISTEN -t >/dev/null ; do
echo "⚠️ Port $PORT is already in use, trying port $((PORT+1))"
PORT=$((PORT+1))
done
echo "🌐 Using port $PORT"
# Create .env file if it doesn't exist
if [ ! -f ".env" ]; then
echo "📝 Creating environment configuration..."
cat > .env << EOF
FLASK_ENV=development
SECRET_KEY=dev-secret-key-$(date +%s)
PORT=$PORT
EOF
echo "✅ Environment file created"
fi
# Set environment variables
export FLASK_ENV=development
export PORT=$PORT
echo ""
echo "🎉 Setup complete! Starting the application..."
echo ""
echo "📱 Access your app at: http://localhost:$PORT"
echo "🔧 Press Ctrl+C to stop the server"
echo "📖 Check USAGE_GUIDE.md for detailed instructions"
echo ""
echo "=================================================="
# Start the application
python app.py