소스 검색

adjust code structure

wangweimin 5 년 전
부모
커밋
468b64449b
2개의 변경된 파일7개의 추가작업 그리고 4개의 파일을 삭제
  1. 6 3
      pywebio/platform/__init__.py
  2. 1 1
      pywebio/session/__init__.py

+ 6 - 3
pywebio/platform/__init__.py

@@ -10,8 +10,11 @@ platform 模块为PyWebIO提供了对不同Web框架的支持。
 
 """
 
-from .tornado import start_server, start_server_in_current_thread_session
-from . import flask
 from . import tornado
+from .tornado import start_server
+
+try:
+    from . import flask
+except ModuleNotFoundError:
+    pass
 
-__all__ = ['start_server']

+ 1 - 1
pywebio/session/__init__.py

@@ -45,7 +45,7 @@ def get_session_implement():
 
 def _start_script_mode_server():
     global _session_type
-    from ..platform import start_server_in_current_thread_session
+    from ..platform.tornado import start_server_in_current_thread_session
     _session_type = ScriptModeSession
     start_server_in_current_thread_session()