-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_server.py
More file actions
66 lines (57 loc) · 1.91 KB
/
start_server.py
File metadata and controls
66 lines (57 loc) · 1.91 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
#!/usr/bin/env python3
"""
Startup script for the DataSaurus search engine with separate scraping process support.
"""
import os
import sys
import subprocess
import time
def check_dependencies():
"""Check if required dependencies are installed"""
try:
import flask
import pymongo
import requests
import psutil
print("✅ All required dependencies are installed")
return True
except ImportError as e:
print(f"❌ Missing dependency: {e}")
print("Please run: pip install -r requirements.txt")
return False
def check_env_file():
"""Check if .env file exists"""
if os.path.exists('.env'):
print("✅ .env file found")
return True
else:
print("❌ .env file not found")
print("Please create a .env file with the required configuration")
return False
def main():
print("🦕 Starting DataSaurus Search Engine...")
print("=" * 50)
# Check dependencies
if not check_dependencies():
sys.exit(1)
# Check .env file
if not check_env_file():
sys.exit(1)
print("\n🚀 Starting Flask server...")
print(" - Scraping now runs as separate processes")
print(" - Search functionality is independent of scraping")
print(" - Admin panel supports process monitoring")
print("\n📱 Access the application at: http://localhost:5000")
print("🔧 Admin panel: http://localhost:5000/#/admin")
print("\nPress Ctrl+C to stop the server")
print("=" * 50)
try:
# Start the Flask application
subprocess.run([sys.executable, "backend/app.py"])
except KeyboardInterrupt:
print("\n\n👋 Server stopped by user")
except Exception as e:
print(f"\n❌ Error starting server: {e}")
sys.exit(1)
if __name__ == "__main__":
main()