-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
32 lines (24 loc) · 1006 Bytes
/
build.py
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
import os
SERVER_SETTING = {
"path_config": "./saponis_config/_config.yml",
"local": {
"HOST": "127.0.0.1", "PORT": 8000, "DEBUG": True},
"deploy": {
"HOST": "https://saponis.herokuapp.com/", "PORT": 80, "DEBUG": False}}
def builder(option):
if option == "config":
mode = input("Run server as (local) or (deploy) mode: ")
settings = SERVER_SETTING[str(mode)]
path = SERVER_SETTING["path_config"]
with open(path, "w") as outfile:
outfile.write("HOST: " + settings['HOST'] + "\n" +
"PORT: " + str(settings["PORT"]) + "\n" +
"DEBUG: " + str(settings["DEBUG"]))
outfile.close()
else:
os.environ["environment"] = "environment"
if not os.path.isdir(os.environ["environment"]):
os.system("virtualenv " + os.environ["environment"])
os.system("bash install")
OPTION = input("build '[config]' or '[server]' : ")
builder(OPTION)