forked from NVIDIA/DIGITS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
digits-devserver
executable file
·62 lines (51 loc) · 1.71 KB
/
digits-devserver
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
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python2
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
import argparse
import sys
import digits
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Run the DIGITS development server')
parser.add_argument('-p', '--port',
type=int,
default=5000,
help='Port to run app on (default 5000)'
)
parser.add_argument('-c', '--config',
action='store_true',
help='Edit the application configuration'
)
parser.add_argument('-d', '--debug',
action='store_true',
help='Run the application in debug mode (reloads when the source changes and gives more detailed error messages)'
)
parser.add_argument('--version',
action='store_true',
help='Print the version number and exit'
)
args = vars(parser.parse_args())
from digits import config
if args['version']:
print digits.__version__
sys.exit()
if args['config']:
config.load_config('normal')
else:
config.load_config('quiet')
from digits.webapp import app, socketio, scheduler
print ' ___ ___ ___ ___ _____ ___'
print ' | \_ _/ __|_ _|_ _/ __|'
print ' | |) | | (_ || | | | \__ \\'
print ' |___/___\___|___| |_| |___/', digits.__version__
print
try:
if not scheduler.start():
print 'ERROR: Scheduler would not start'
else:
app.debug = args['debug']
socketio.run(app, '0.0.0.0', args['port'],
policy_server=False
)
except KeyboardInterrupt:
pass
finally:
scheduler.stop()