Merge pull request #2917 from garenchan/docs1

Docs: fix some errors in errorhandling.rst
This commit is contained in:
Hsiaoming Yang 2018-11-28 22:25:21 +09:00 committed by GitHub
commit d5665e4ba6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -75,9 +75,9 @@ Error handlers
You might want to show custom error pages to the user when an error occurs. You might want to show custom error pages to the user when an error occurs.
This can be done by registering error handlers. This can be done by registering error handlers.
An error handler is a normal view function that return a response, but instead An error handler is a normal view function that returns a response, but instead
of being registered for a route, it is registered for an exception or HTTP of being registered for a route, it is registered for an exception or HTTP
status code that would is raised while trying to handle a request. status code that would be raised while trying to handle a request.
Registering Registering
``````````` ```````````
@ -183,7 +183,7 @@ options in order to use your favorite debugger:
* ``debug`` - whether to enable debug mode and catch exceptions * ``debug`` - whether to enable debug mode and catch exceptions
* ``use_debugger`` - whether to use the internal Flask debugger * ``use_debugger`` - whether to use the internal Flask debugger
* ``use_reloader`` - whether to reload and fork the process on exception * ``use_reloader`` - whether to reload and fork the process if modules were changed
``debug`` must be True (i.e., exceptions must be caught) in order for the other ``debug`` must be True (i.e., exceptions must be caught) in order for the other
two options to have any value. two options to have any value.
@ -204,11 +204,6 @@ Then in your application's entry-point (main.py), you could have something like:
# To allow aptana to receive errors, set use_debugger=False # To allow aptana to receive errors, set use_debugger=False
app = create_app(config="config.yaml") app = create_app(config="config.yaml")
if app.debug: use_debugger = True use_debugger = app.debug and not(app.config.get('DEBUG_WITH_APTANA'))
try:
# Disable Flask's debugger if external debugger is requested
use_debugger = not(app.config.get('DEBUG_WITH_APTANA'))
except:
pass
app.run(use_debugger=use_debugger, debug=app.debug, app.run(use_debugger=use_debugger, debug=app.debug,
use_reloader=use_debugger, host='0.0.0.0') use_reloader=use_debugger, host='0.0.0.0')