-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSTART_BACKEND.py
More file actions
36 lines (32 loc) · 789 Bytes
/
Copy pathSTART_BACKEND.py
File metadata and controls
36 lines (32 loc) · 789 Bytes
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
#!/usr/bin/env python
"""
Simple script to start the PNGProtect backend server.
Run this from the backend directory.
"""
import subprocess
import sys
import os
# Change to backend directory
backend_dir = os.path.dirname(os.path.abspath(__file__))
backend_dir = os.path.join(backend_dir, 'backend')
print("=" * 60)
print("PNGProtect Backend Server")
print("=" * 60)
print(f"Starting from: {backend_dir}")
print()
# Start uvicorn
try:
os.chdir(backend_dir)
subprocess.run([
sys.executable, '-m', 'uvicorn',
'app.main:app',
'--reload',
'--host', '127.0.0.1',
'--port', '8000'
])
except KeyboardInterrupt:
print("\n\nServer stopped.")
sys.exit(0)
except Exception as e:
print(f"Error starting server: {e}")
sys.exit(1)