-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
33 lines (25 loc) · 948 Bytes
/
run.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
__all__ = "application"
from tornado.ioloop import IOLoop
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from werkzeug.serving import run_simple
from sup import create_app
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-p", "--port", default=3031, type=int,
help="the port to expose")
parser.add_argument("-d", "--debug", action="store_true",
help="debugging interface")
args = parser.parse_args()
application = create_app()
if args.debug:
run_simple("0.0.0.0", args.port, application, use_reloader=True,
use_debugger=True)
else:
http_server = HTTPServer(WSGIContainer(application))
http_server.listen(args.port)
IOLoop.instance().start()