瀏覽代碼

enable access submodule via property of `pywebio`

wangweimin 3 年之前
父節點
當前提交
64b2230892
共有 2 個文件被更改,包括 22 次插入1 次删除
  1. 1 1
      pywebio/__init__.py
  2. 21 0
      pywebio/platform/__init__.py

+ 1 - 1
pywebio/__init__.py

@@ -1,4 +1,4 @@
-from . import input  # make PyCharm understand `pywebio.input.xxx` expression
+from . import input  # enable `pywebio.input.xxx` expression without `import pywebio.input`
 from . import output
 from . import platform
 from . import session

+ 21 - 0
pywebio/platform/__init__.py

@@ -149,3 +149,24 @@ from .page import config
 from .page import seo
 from .path_deploy import path_deploy_http, path_deploy
 from .tornado import start_server
+from . import tornado
+
+try:
+    from . import flask  # enable `pywebio.platform.flask.xxx` expression without `import pywebio.platform.flask`
+except Exception:
+    pass
+
+try:
+    from . import django
+except Exception:
+    pass
+
+try:
+    from . import fastapi
+except Exception:
+    pass
+
+try:
+    from . import tornado_http
+except Exception:
+    pass