2023-08-01 02:38:55 +02:00
|
|
|
"""Starts the API.
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
$ python run 1234
|
|
|
|
Runs on port 1234.
|
|
|
|
|
|
|
|
$ python run prod
|
|
|
|
Runs for production.
|
|
|
|
|
|
|
|
$ python run 1234 prod
|
|
|
|
Runs for production on the speicified port.
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
2023-06-23 11:20:25 +02:00
|
|
|
import os
|
2023-08-01 02:38:55 +02:00
|
|
|
import sys
|
2023-08-20 12:29:13 +02:00
|
|
|
import time
|
2023-08-01 02:38:55 +02:00
|
|
|
|
|
|
|
port = sys.argv[1] if len(sys.argv) > 1 else 2332
|
|
|
|
dev = True
|
|
|
|
|
|
|
|
if 'prod' in sys.argv:
|
|
|
|
port = 2333
|
|
|
|
dev = False
|
2023-06-23 11:20:25 +02:00
|
|
|
|
2023-08-23 23:27:09 +02:00
|
|
|
os.system(f'cd api && uvicorn main:app{" --reload" if dev else ""} --host 0.0.0.0 --port {port}')
|