-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprks_app.py
More file actions
33 lines (28 loc) · 988 Bytes
/
prks_app.py
File metadata and controls
33 lines (28 loc) · 988 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
#!/usr/bin/env python3
import argparse
import os
import sys
# Must run before importing backend.server (module-level DB and paths).
if "--testing" in sys.argv:
os.environ["PRKS_TESTING"] = "1"
from backend.log_config import setup_logging
setup_logging()
from backend.server import run_server, PORT
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="PRKS — Personal Research Knowledge System")
parser.add_argument(
"--testing",
action="store_true",
help="Use data_testing/prks_data_testing.db and data_testing/pdfs (separate from data/).",
)
parser.add_argument(
"--port",
type=int,
default=None,
help=f"Port to bind the server to (default: {PORT}, or 8070 for --testing).",
)
args = parser.parse_args()
if args.testing:
os.environ["PRKS_TESTING"] = "1"
port = args.port if args.port is not None else (8070 if args.testing else PORT)
run_server(port=port)