-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.py
executable file
·49 lines (39 loc) · 1.4 KB
/
manage.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
import os
import sys
from django.core.management import execute_from_command_line
import logging
from ConfigParser import SafeConfigParser
version = 1.5
if __name__ == "__main__":
# if sys.argv[1] == "runserver":
i = 1
confFile = None
for param in sys.argv:
if param == "--d":
if len(sys.argv) > i:
confFile = sys.argv[i]
break
else:
print ("Wrong params usage --d [conf-file]")
sys.exit(1)
i += 1
parser = SafeConfigParser()
if confFile is not None:
parser.read(confFile)
else:
confFile = "config/default-config.ini"
parser.read(confFile)
os.environ.setdefault("FG-GUI_CONF", confFile)
logging.basicConfig(filename=parser.get('logging', 'filename'), format='%(asctime)s %(levelname)s:%(message)s',
level=parser.get('logging', 'level'))
params = [sys.argv[0], sys.argv[1]]
if sys.argv[1] == "runserver":
gui_endpoint = parser.get('fg-gui', 'gui_endpoint')
params.append(gui_endpoint)
logging.info('Running FG-GUI with version %s', version)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_setting.settings")
execute_from_command_line(params)
else:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_setting.settings")
execute_from_command_line(sys.argv)