-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathstartLp.py
More file actions
25 lines (21 loc) · 749 Bytes
/
startLp.py
File metadata and controls
25 lines (21 loc) · 749 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
from localpaste import app_global
import argparse
import os
if __name__ == "__main__":
# Parse the arguments
parser = argparse.ArgumentParser()
parser.add_argument("--db", help="the db file", type=str)
parser.add_argument("--port", help="port: default=5000",
type=int, default=5000)
arg = parser.parse_args()
# print(arg.db)
if arg.db and arg.db.endswith(".db"):
print("swithing db to", arg.db)
if os.path.exists(arg.db):
print("file exists")
app_global.config["DB_FILE"] = arg.db
app_global.getDb()
print(app_global.config)
from localpaste.main import startServer, addResources
addResources()
startServer(port=arg.port)