forked from lfnovo/open-notebook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_api.py
More file actions
31 lines (25 loc) · 754 Bytes
/
run_api.py
File metadata and controls
31 lines (25 loc) · 754 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
#!/usr/bin/env python3
"""
Startup script for Open Notebook API server.
"""
import os
import sys
from pathlib import Path
import uvicorn
# Add the current directory to Python path so imports work
current_dir = Path(__file__).parent
sys.path.insert(0, str(current_dir))
if __name__ == "__main__":
# Default configuration
host = os.getenv("API_HOST", "127.0.0.1")
port = int(os.getenv("API_PORT", "5055"))
reload = os.getenv("API_RELOAD", "true").lower() == "true"
print(f"Starting Open Notebook API server on {host}:{port}")
print(f"Reload mode: {reload}")
uvicorn.run(
"api.main:app",
host=host,
port=port,
reload=reload,
reload_dirs=[str(current_dir)] if reload else None,
)