refactor lazy loading

Remove the `--eager-loading/--lazy-loading` options and the
`DispatchingApp` middleware. The `run` command handles loading
exceptions directly. The reloader always prints out tracebacks
immediately and always defers raising the error.
This commit is contained in:
David Lord 2022-08-01 09:13:01 -07:00
parent 095651be9e
commit 5d8e35653f
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
6 changed files with 31 additions and 118 deletions

View file

@ -127,24 +127,19 @@ macOS Monterey and later automatically starts a service that uses port
disable "AirPlay Receiver".
Lazy or Eager Loading
~~~~~~~~~~~~~~~~~~~~~
Deferred Errors on Reload
~~~~~~~~~~~~~~~~~~~~~~~~~
When using the ``flask run`` command with the reloader, the server will
continue to run even if you introduce syntax errors or other
initialization errors into the code. Accessing the site will show the
interactive debugger for the error, rather than crashing the server.
This feature is called "lazy loading".
If a syntax error is already present when calling ``flask run``, it will
fail immediately and show the traceback rather than waiting until the
site is accessed. This is intended to make errors more visible initially
while still allowing the server to handle errors on reload.
To override this behavior and always fail immediately, even on reload,
pass the ``--eager-loading`` option. To always keep the server running,
even on the initial call, pass ``--lazy-loading``.
In Code
-------