Method: flask.app.Flask.wsgi_app
Calls: 423, Exceptions: 36, Paths: 8Back
Path 1: 353 calls (0.83)
dict (353)
run_wsgi_app.
1def wsgi_app(self, environ: dict, start_response: t.Callable) -> t.Any:
2 """The actual WSGI application. This is not implemented in
3 :meth:`__call__` so that middlewares can be applied without
4 losing a reference to the app object. Instead of doing this::
5
6 app = MyMiddleware(app)
7
8 It's a better idea to do this instead::
9
10 app.wsgi_app = MyMiddleware(app.wsgi_app)
11
12 Then you still have the original application object around and
13 can continue to call methods on it.
14
15 .. versionchanged:: 0.7
16 Teardown events for the request and app contexts are called
17 even if an unhandled error occurs. Other events may not be
18 called depending on when an error occurs during dispatch.
19 See :ref:`callbacks-and-errors`.
20
21 :param environ: A WSGI environment.
22 :param start_response: A callable accepting a status code,
23 a list of headers, and an optional exception context to
24 start the response.
25 """
26 ctx = self.request_context(environ)
27 error: BaseException | None = None
28 try:
29 try:
30 ctx.push()
31 response = self.full_dispatch_request()
32 except Exception as e:
33 error = e
34 response = self.handle_exception(e)
35 except: # noqa: B001
36 error = sys.exc_info()[1]
37 raise
38 return response(environ, start_response)
39 finally:
40 if "werkzeug.debug.preserve_context" in environ:
41 environ["werkzeug.debug.preserve_context"](_cv_app.get())
42 environ["werkzeug.debug.preserve_context"](_cv_request.get())
43
44 if error is not None and self.should_ignore_error(error):
45 error = None
46
47 ctx.pop(error)
Path 2: 34 calls (0.08)
dict (34)
run_wsgi_app.
1def wsgi_app(self, environ: dict, start_response: t.Callable) -> t.Any:
2 """The actual WSGI application. This is not implemented in
3 :meth:`__call__` so that middlewares can be applied without
4 losing a reference to the app object. Instead of doing this::
5
6 app = MyMiddleware(app)
7
8 It's a better idea to do this instead::
9
10 app.wsgi_app = MyMiddleware(app.wsgi_app)
11
12 Then you still have the original application object around and
13 can continue to call methods on it.
14
15 .. versionchanged:: 0.7
16 Teardown events for the request and app contexts are called
17 even if an unhandled error occurs. Other events may not be
18 called depending on when an error occurs during dispatch.
19 See :ref:`callbacks-and-errors`.
20
21 :param environ: A WSGI environment.
22 :param start_response: A callable accepting a status code,
23 a list of headers, and an optional exception context to
24 start the response.
25 """
26 ctx = self.request_context(environ)
27 error: BaseException | None = None
28 try:
29 try:
30 ctx.push()
31 response = self.full_dispatch_request()
32 except Exception as e:
33 error = e
34 response = self.handle_exception(e)
35 except: # noqa: B001
36 error = sys.exc_info()[1]
37 raise
38 return response(environ, start_response)
39 finally:
40 if "werkzeug.debug.preserve_context" in environ:
41 environ["werkzeug.debug.preserve_context"](_cv_app.get())
42 environ["werkzeug.debug.preserve_context"](_cv_request.get())
43
44 if error is not None and self.should_ignore_error(error):
45 error = None
46
47 ctx.pop(error)
Path 3: 16 calls (0.04)
dict (16)
run_wsgi_app.
ZeroDivisionError (8) KeyError (4) Exception (2) Custom (2)
1def wsgi_app(self, environ: dict, start_response: t.Callable) -> t.Any:
2 """The actual WSGI application. This is not implemented in
3 :meth:`__call__` so that middlewares can be applied without
4 losing a reference to the app object. Instead of doing this::
5
6 app = MyMiddleware(app)
7
8 It's a better idea to do this instead::
9
10 app.wsgi_app = MyMiddleware(app.wsgi_app)
11
12 Then you still have the original application object around and
13 can continue to call methods on it.
14
15 .. versionchanged:: 0.7
16 Teardown events for the request and app contexts are called
17 even if an unhandled error occurs. Other events may not be
18 called depending on when an error occurs during dispatch.
19 See :ref:`callbacks-and-errors`.
20
21 :param environ: A WSGI environment.
22 :param start_response: A callable accepting a status code,
23 a list of headers, and an optional exception context to
24 start the response.
25 """
26 ctx = self.request_context(environ)
27 error: BaseException | None = None
28 try:
29 try:
30 ctx.push()
31 response = self.full_dispatch_request()
32 except Exception as e:
33 error = e
34 response = self.handle_exception(e)
35 except: # noqa: B001
36 error = sys.exc_info()[1]
37 raise
38 return response(environ, start_response)
39 finally:
40 if "werkzeug.debug.preserve_context" in environ:
41 environ["werkzeug.debug.preserve_context"](_cv_app.get())
42 environ["werkzeug.debug.preserve_context"](_cv_request.get())
43
44 if error is not None and self.should_ignore_error(error):
45 error = None
46
47 ctx.pop(error)
Path 4: 15 calls (0.04)
dict (15)
run_wsgi_app.
TypeError (5) ZeroDivisionError (3) ValueError (2) BadRequestKeyError (2) BadRequest (1) NotFound (1) DebugFilesKeyError (1)
1def wsgi_app(self, environ: dict, start_response: t.Callable) -> t.Any:
2 """The actual WSGI application. This is not implemented in
3 :meth:`__call__` so that middlewares can be applied without
4 losing a reference to the app object. Instead of doing this::
5
6 app = MyMiddleware(app)
7
8 It's a better idea to do this instead::
9
10 app.wsgi_app = MyMiddleware(app.wsgi_app)
11
12 Then you still have the original application object around and
13 can continue to call methods on it.
14
15 .. versionchanged:: 0.7
16 Teardown events for the request and app contexts are called
17 even if an unhandled error occurs. Other events may not be
18 called depending on when an error occurs during dispatch.
19 See :ref:`callbacks-and-errors`.
20
21 :param environ: A WSGI environment.
22 :param start_response: A callable accepting a status code,
23 a list of headers, and an optional exception context to
24 start the response.
25 """
26 ctx = self.request_context(environ)
27 error: BaseException | None = None
28 try:
29 try:
30 ctx.push()
31 response = self.full_dispatch_request()
32 except Exception as e:
33 error = e
34 response = self.handle_exception(e)
35 except: # noqa: B001
36 error = sys.exc_info()[1]
37 raise
38 return response(environ, start_response)
39 finally:
40 if "werkzeug.debug.preserve_context" in environ:
41 environ["werkzeug.debug.preserve_context"](_cv_app.get())
42 environ["werkzeug.debug.preserve_context"](_cv_request.get())
43
44 if error is not None and self.should_ignore_error(error):
45 error = None
46
47 ctx.pop(error)
Path 5: 2 calls (0.0)
dict (2)
run_wsgi_app.
FormDataRoutingRedirect (1) TemplateNotFound (1)
1def wsgi_app(self, environ: dict, start_response: t.Callable) -> t.Any:
2 """The actual WSGI application. This is not implemented in
3 :meth:`__call__` so that middlewares can be applied without
4 losing a reference to the app object. Instead of doing this::
5
6 app = MyMiddleware(app)
7
8 It's a better idea to do this instead::
9
10 app.wsgi_app = MyMiddleware(app.wsgi_app)
11
12 Then you still have the original application object around and
13 can continue to call methods on it.
14
15 .. versionchanged:: 0.7
16 Teardown events for the request and app contexts are called
17 even if an unhandled error occurs. Other events may not be
18 called depending on when an error occurs during dispatch.
19 See :ref:`callbacks-and-errors`.
20
21 :param environ: A WSGI environment.
22 :param start_response: A callable accepting a status code,
23 a list of headers, and an optional exception context to
24 start the response.
25 """
26 ctx = self.request_context(environ)
27 error: BaseException | None = None
28 try:
29 try:
30 ctx.push()
31 response = self.full_dispatch_request()
32 except Exception as e:
33 error = e
34 response = self.handle_exception(e)
35 except: # noqa: B001
36 error = sys.exc_info()[1]
37 raise
38 return response(environ, start_response)
39 finally:
40 if "werkzeug.debug.preserve_context" in environ:
41 environ["werkzeug.debug.preserve_context"](_cv_app.get())
42 environ["werkzeug.debug.preserve_context"](_cv_request.get())
43
44 if error is not None and self.should_ignore_error(error):
45 error = None
46
47 ctx.pop(error)
Path 6: 1 calls (0.0)
dict (1)
run_wsgi_app.
KeyboardInterrupt (1)
1def wsgi_app(self, environ: dict, start_response: t.Callable) -> t.Any:
2 """The actual WSGI application. This is not implemented in
3 :meth:`__call__` so that middlewares can be applied without
4 losing a reference to the app object. Instead of doing this::
5
6 app = MyMiddleware(app)
7
8 It's a better idea to do this instead::
9
10 app.wsgi_app = MyMiddleware(app.wsgi_app)
11
12 Then you still have the original application object around and
13 can continue to call methods on it.
14
15 .. versionchanged:: 0.7
16 Teardown events for the request and app contexts are called
17 even if an unhandled error occurs. Other events may not be
18 called depending on when an error occurs during dispatch.
19 See :ref:`callbacks-and-errors`.
20
21 :param environ: A WSGI environment.
22 :param start_response: A callable accepting a status code,
23 a list of headers, and an optional exception context to
24 start the response.
25 """
26 ctx = self.request_context(environ)
27 error: BaseException | None = None
28 try:
29 try:
30 ctx.push()
31 response = self.full_dispatch_request()
32 except Exception as e:
33 error = e
34 response = self.handle_exception(e)
35 except: # noqa: B001
36 error = sys.exc_info()[1]
37 raise
38 return response(environ, start_response)
39 finally:
40 if "werkzeug.debug.preserve_context" in environ:
41 environ["werkzeug.debug.preserve_context"](_cv_app.get())
42 environ["werkzeug.debug.preserve_context"](_cv_request.get())
43
44 if error is not None and self.should_ignore_error(error):
45 error = None
46
47 ctx.pop(error)
Path 7: 1 calls (0.0)
dict (1)
run_wsgi_app.
SessionError (1)
1def wsgi_app(self, environ: dict, start_response: t.Callable) -> t.Any:
2 """The actual WSGI application. This is not implemented in
3 :meth:`__call__` so that middlewares can be applied without
4 losing a reference to the app object. Instead of doing this::
5
6 app = MyMiddleware(app)
7
8 It's a better idea to do this instead::
9
10 app.wsgi_app = MyMiddleware(app.wsgi_app)
11
12 Then you still have the original application object around and
13 can continue to call methods on it.
14
15 .. versionchanged:: 0.7
16 Teardown events for the request and app contexts are called
17 even if an unhandled error occurs. Other events may not be
18 called depending on when an error occurs during dispatch.
19 See :ref:`callbacks-and-errors`.
20
21 :param environ: A WSGI environment.
22 :param start_response: A callable accepting a status code,
23 a list of headers, and an optional exception context to
24 start the response.
25 """
26 ctx = self.request_context(environ)
27 error: BaseException | None = None
28 try:
29 try:
30 ctx.push()
31 response = self.full_dispatch_request()
32 except Exception as e:
33 error = e
34 response = self.handle_exception(e)
35 except: # noqa: B001
36 error = sys.exc_info()[1]
37 raise
38 return response(environ, start_response)
39 finally:
40 if "werkzeug.debug.preserve_context" in environ:
41 environ["werkzeug.debug.preserve_context"](_cv_app.get())
42 environ["werkzeug.debug.preserve_context"](_cv_request.get())
43
44 if error is not None and self.should_ignore_error(error):
45 error = None
46
47 ctx.pop(error)
Path 8: 1 calls (0.0)
dict (1)
run_wsgi_app.
ZeroDivisionError (1)
1def wsgi_app(self, environ: dict, start_response: t.Callable) -> t.Any:
2 """The actual WSGI application. This is not implemented in
3 :meth:`__call__` so that middlewares can be applied without
4 losing a reference to the app object. Instead of doing this::
5
6 app = MyMiddleware(app)
7
8 It's a better idea to do this instead::
9
10 app.wsgi_app = MyMiddleware(app.wsgi_app)
11
12 Then you still have the original application object around and
13 can continue to call methods on it.
14
15 .. versionchanged:: 0.7
16 Teardown events for the request and app contexts are called
17 even if an unhandled error occurs. Other events may not be
18 called depending on when an error occurs during dispatch.
19 See :ref:`callbacks-and-errors`.
20
21 :param environ: A WSGI environment.
22 :param start_response: A callable accepting a status code,
23 a list of headers, and an optional exception context to
24 start the response.
25 """
26 ctx = self.request_context(environ)
27 error: BaseException | None = None
28 try:
29 try:
30 ctx.push()
31 response = self.full_dispatch_request()
32 except Exception as e:
33 error = e
34 response = self.handle_exception(e)
35 except: # noqa: B001
36 error = sys.exc_info()[1]
37 raise
38 return response(environ, start_response)
39 finally:
40 if "werkzeug.debug.preserve_context" in environ:
41 environ["werkzeug.debug.preserve_context"](_cv_app.get())
42 environ["werkzeug.debug.preserve_context"](_cv_request.get())
43
44 if error is not None and self.should_ignore_error(error):
45 error = None
46
47 ctx.pop(error)