-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-servers.py
More file actions
48 lines (40 loc) · 1.16 KB
/
check-servers.py
File metadata and controls
48 lines (40 loc) · 1.16 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
import requests
import time
import webbrowser
def check_backend():
try:
response = requests.get("http://localhost:5000", timeout=5)
return True
except:
return False
def check_frontend():
try:
response = requests.get("http://localhost:3000", timeout=5)
return True
except:
return False
def main():
print("🔍 Checking server status...")
print("=" * 50)
# Check Backend
print("Backend (Flask): ", end="")
if check_backend():
print("✅ Running on http://localhost:5000")
else:
print("❌ Not running")
# Check Frontend
print("Frontend (React): ", end="")
if check_frontend():
print("✅ Running on http://localhost:3000")
else:
print("❌ Not running")
print("=" * 50)
if check_backend() and check_frontend():
print("🎉 Both servers are running!")
print("Opening your application...")
webbrowser.open("http://localhost:3000")
else:
print("⚠️ Some servers are not running.")
print("Please check the terminal windows for any errors.")
if __name__ == "__main__":
main()