Browse Source

amend(3abc9541): show in-app error in debug mode

wangweimin 3 years ago
parent
commit
22fbbf866f
1 changed files with 4 additions and 2 deletions
  1. 4 2
      pywebio/platform/path_deploy.py

+ 4 - 2
pywebio/platform/path_deploy.py

@@ -13,7 +13,7 @@ from .httpbased import HttpHandler
 from .tornado import webio_handler, set_ioloop
 from .tornado_http import TornadoHttpContext
 from .utils import cdn_validation, make_applications
-from ..session import register_session_implement, CoroutineBasedSession, ThreadBasedSession
+from ..session import register_session_implement, CoroutineBasedSession, ThreadBasedSession, Session
 from ..utils import get_free_port, STATIC_PATH, parse_file_size
 
 
@@ -245,7 +245,7 @@ def path_deploy(base, port=0, host='',
 
     The rest arguments of ``path_deploy()`` have the same meaning as for :func:`pywebio.platform.tornado.start_server`
     """
-
+    debug = Session.debug = os.environ.get('PYWEBIO_DEBUG', debug)
     utils.MAX_PAYLOAD_SIZE = max_payload_size = parse_file_size(max_payload_size)
     # Since some cloud server may close idle connections (such as heroku),
     # use `websocket_ping_interval` to  keep the connection alive
@@ -301,6 +301,8 @@ def path_deploy_http(base, port=0, host='',
 
     The rest arguments of ``path_deploy_http()`` have the same meaning as for :func:`pywebio.platform.tornado_http.start_server`
     """
+    debug = Session.debug = os.environ.get('PYWEBIO_DEBUG', debug)
+
     utils.MAX_PAYLOAD_SIZE = max_payload_size = parse_file_size(max_payload_size)
 
     gen = _path_deploy(base, port=port, host=host,