-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
42 lines (33 loc) · 864 Bytes
/
Copy pathrun.py
File metadata and controls
42 lines (33 loc) · 864 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
37
38
39
40
41
42
#!/usr/bin/env python3
import subprocess
import sys
def install_requirements():
print("Installing requirements...")
subprocess.check_call(
[sys.executable, "-m", "pip", "install", "-r", "requirements.txt"]
)
def run_server():
print("Starting GitHitBox...")
print("Server will be available at: http://localhost:3001")
print("API Documentation: http://localhost:3001/docs")
print("\nPress Ctrl+C to stop the server")
subprocess.run(
[
sys.executable,
"-m",
"uvicorn",
"main:app",
"--host",
"0.0.0.0",
"--port",
"3001",
"--reload",
]
)
if __name__ == "__main__":
try:
import fastapi
import uvicorn
except ImportError:
install_requirements()
run_server()