|
11 | 11 |
|
12 | 12 | logger = logging.getLogger('quit.run') |
13 | 13 |
|
| 14 | +sys.setrecursionlimit(2 ** 15) |
14 | 15 |
|
15 | | -def main(): |
16 | | - sys.setrecursionlimit(2 ** 15) |
| 16 | +defaults = getDefaults() |
| 17 | +env = parseEnv() |
| 18 | +args = parseArgs(sys.argv[1:]) |
| 19 | +args = {**defaults, **env, **args} |
| 20 | +application = create_app(args) |
17 | 21 |
|
18 | | - defaults = getDefaults() |
19 | | - env = parseEnv() |
20 | | - args = parseArgs(sys.argv[1:]) |
21 | | - args = {**defaults, **env, **args} |
22 | | - application = create_app(args) |
| 22 | +# Set the basepath |
| 23 | +if args['basepath']: |
| 24 | + logger.info("Configure DispatcherMiddleware for basepath \"{}\"".format(args['basepath'])) |
23 | 25 |
|
24 | | - # Set the basepath |
25 | | - if args['basepath']: |
26 | | - logger.info("Configure DispatcherMiddleware for basepath \"{}\"".format(args['basepath'])) |
| 26 | + def simple(env, resp): |
| 27 | + """A simple WSGI application. |
27 | 28 |
|
28 | | - def simple(env, resp): |
29 | | - """A simple WSGI application. |
| 29 | + See also: http://werkzeug.pocoo.org/docs/0.14/middlewares/ |
| 30 | + """ |
| 31 | + resp('200 OK', [('Content-Type', 'text/plain')]) |
30 | 32 |
|
31 | | - See also: http://werkzeug.pocoo.org/docs/0.14/middlewares/ |
32 | | - """ |
33 | | - resp('200 OK', [('Content-Type', 'text/plain')]) |
34 | | - |
35 | | - application.wsgi_app = DispatcherMiddleware( |
| 33 | + application.wsgi_app = DispatcherMiddleware( |
36 | 34 | simple, {args['basepath']: application.wsgi_app}) |
37 | 35 |
|
| 36 | +if __name__ == "__main__": |
38 | 37 | application.run(debug=args['flask_debug'], |
39 | 38 | use_reloader=False, |
40 | 39 | host=args['host'], |
41 | 40 | port=args['port']) |
42 | | - |
43 | | - |
44 | | -if __name__ == "__main__": |
45 | | - main() |
0 commit comments