浏览代码

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()