This repository was archived by the owner on Mar 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathrunserver.py
More file actions
executable file
·50 lines (41 loc) · 1.4 KB
/
runserver.py
File metadata and controls
executable file
·50 lines (41 loc) · 1.4 KB
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
#!/usr/bin/env python2
# These two lines are needed to run on EL6
__requires__ = ['SQLAlchemy >= 0.8', 'jinja2 >= 2.4']
import pkg_resources
import argparse
import sys
import os
parser = argparse.ArgumentParser(
description='Run the web app')
parser.add_argument(
'--config', '-c', dest='config',
help='Configuration file to use for nuancier.')
parser.add_argument(
'--debug', dest='debug', action='store_true',
default=False,
help='Expand the level of data returned.')
parser.add_argument(
'--profile', dest='profile', action='store_true',
default=False,
help='Profile the web application.')
parser.add_argument(
'--port', '-p', default=5000,
help='Port where the app should run.')
parser.add_argument(
'--host', default="127.0.0.1",
help='Hostname to listen on. When set to 0.0.0.0 the server is available '
'externally. Defaults to 127.0.0.1 making the it only visable on '
'localhost')
args = parser.parse_args()
if args.config:
config = args.config
if not config.startswith('/'):
config = os.path.join(os.getcwd(), config)
os.environ['NUANCIER_CONFIG'] = config
from nuancier import APP
if args.profile:
from werkzeug.contrib.profiler import ProfilerMiddleware
APP.config['PROFILE'] = True
APP.wsgi_app = ProfilerMiddleware(APP.wsgi_app, restrictions=[30])
APP.debug = True
APP.run(host=args.host, port=int(args.port))