forked from quokkaproject/quokka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwsgi.py
31 lines (26 loc) · 1007 Bytes
/
wsgi.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
#!/usr/bin/python
import argparse
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from quokka import create_app, create_api
from quokka.utils.paas import activate
application = DispatcherMiddleware(create_app(), {
'/api': create_api()
})
application = app = activate(application)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Run Quokka App for WSGI")
parser.add_argument('-p', '--port', help='App Port')
parser.add_argument('-i', '--host', help='App Host')
parser.add_argument('-r', '--reloader', action='store_true',
help='Turn reloader on')
parser.add_argument('-d', '--debug', action='store_true',
help='Turn debug on')
args = parser.parse_args()
run_simple(
args.host or '0.0.0.0',
int(args.port) if args.port else 5000,
application,
use_reloader=args.reloader or False,
use_debugger=args.debug or False,
)