forked from NVIDIA/DIGITS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdigits-devserver
executable file
·55 lines (45 loc) · 1.52 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
#!/usr/bin/env python
# Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
import sys
import argparse
# Only required if using SocketIO.run() and app.debug = False
from gevent import monkey; monkey.patch_all()
if __name__ == '__main__':
print ' ___ ___ ___ ___ _____ ___'
print ' | \_ _/ __|_ _|_ _/ __|'
print ' | |) | | (_ || | | | \__ \\'
print ' |___/___\___|___| |_| |___/'
print
parser = argparse.ArgumentParser(description='Run DIGITS in debug mode')
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 manually'
)
parser.add_argument('-d', '--debug',
action='store_true',
help='Run the application in debug mode (with the reloader)'
)
args = vars(parser.parse_args())
from digits import config
if args['config']:
config.load_config('verbose')
else:
config.load_config('quiet')
from digits.webapp import app, socketio, scheduler
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()