-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_dashboard.sh
More file actions
executable file
Β·118 lines (94 loc) Β· 2.88 KB
/
start_dashboard.sh
File metadata and controls
executable file
Β·118 lines (94 loc) Β· 2.88 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash
# Stock Analysis Dashboard Startup Script
# This script starts the complete dashboard system
echo "π Stock Analysis Dashboard - Startup Script"
echo "============================================="
# Check if we're in the right directory
if [ ! -f "Frontend/app.py" ]; then
echo "β Error: Please run this script from the project root directory"
echo " Make sure you're in the Stock_Analysis_Prediction folder"
exit 1
fi
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "β Error: Python 3 is not installed"
echo " Please install Python 3.8 or higher"
exit 1
fi
echo "β
Python found: $(python3 --version)"
# Check if pip is installed
if ! command -v pip3 &> /dev/null; then
echo "β Error: pip3 is not installed"
exit 1
fi
echo "β
pip found: $(pip3 --version)"
# Navigate to Frontend directory
cd Frontend
# Check if requirements.txt exists
if [ ! -f "requirements.txt" ]; then
echo "β Error: requirements.txt not found in Frontend directory"
exit 1
fi
# Install dependencies
echo ""
echo "π¦ Installing Python dependencies..."
pip3 install -r requirements.txt
if [ $? -ne 0 ]; then
echo "β Error: Failed to install dependencies"
echo " Please check your internet connection and try again"
exit 1
fi
echo "β
Dependencies installed successfully"
# Check if PostgreSQL is running
echo ""
echo "ποΈ Checking PostgreSQL connection..."
# Try to connect to PostgreSQL (adjust credentials as needed)
python3 -c "
import psycopg2
try:
conn = psycopg2.connect(
dbname='mydb',
user='melvint',
password='MelvinGeorgi',
host='localhost',
port='5432'
)
conn.close()
print('β
PostgreSQL connection successful')
except Exception as e:
print(f'β PostgreSQL connection failed: {e}')
print('Please ensure PostgreSQL is running and credentials are correct')
exit(1)
"
if [ $? -ne 0 ]; then
exit 1
fi
# Check if .env file exists
if [ ! -f "../.env" ]; then
echo ""
echo "β οΈ Warning: .env file not found"
echo " Creating a template .env file..."
cat > ../.env << EOF
# Stock Analysis Dashboard Environment Variables
# Replace with your actual API keys
# Polygon.io API Key (for market data)
POLYGON_API_KEY=your_polygon_api_key_here
# NewsAPI Key (for sentiment analysis)
NEWS_API_KEY=your_news_api_key_here
EOF
echo "β
Created .env template file"
echo " Please edit .env file and add your API keys"
echo " Then run this script again"
exit 1
fi
echo "β
Environment file found"
# Start the server
echo ""
echo "π Starting Stock Analysis Dashboard..."
echo " Server will be available at: http://localhost:5000"
echo " Press Ctrl+C to stop the server"
echo ""
# Run the startup script
python3 run_server.py
echo ""
echo "π Dashboard stopped. Thank you for using Stock Analysis Dashboard!"