Browse Source

doc: update

wangweimin 4 years ago
parent
commit
3ef051dee1

+ 20 - 4
docs/guide.rst

@@ -590,13 +590,13 @@ You can set the CSS style for a single ``put_xxx()`` output:
 Server mode and Script mode
 ------------------------------------
 
-In the :ref:`Hello, world <hello_word>` section, we already know that PyWebIO supports two modes: running as a script and using `start_server() <pywebio.platform.tornado.start_server>` to run as a web service.
+In PyWebIO, there are two modes to run PyWebIO applications: running as a script and using `start_server() <pywebio.platform.tornado.start_server>` or `path_deploy() <pywebio.platform.path_deploy>` to run as a web service.
 
 **Server mode**
 
-In Server mode, PyWebIO will start a web server to continuously provide services. A task function needs to be provided. When the user accesses the service address, PyWebIO will open a new session and run the task function.
+In Server mode, PyWebIO will start a web server to continuously provide services. When the user accesses the service address, PyWebIO will open a new session and run PyWebIO application in it.
 
-Use `start_server() <pywebio.platform.tornado.start_server>` to start a web service. In addition to accepting a function as task function, ``start_server()`` also accepts a list of task function or a dictionary of it, so that one PyWebIO Server can have multiple services with different functions. You can use `go_app() <pywebio.session.go_app>` or `put_link() <pywebio.output.put_link>` to jump between services::
+Use `start_server() <pywebio.platform.tornado.start_server>` to start a web server and serve given PyWebIO applications on it. `start_server() <pywebio.platform.tornado.start_server>` accepts a function as PyWebIO application. In addition, `start_server() <pywebio.platform.tornado.start_server>` also accepts a list of task function or a dictionary of it, so that one PyWebIO Server can have multiple services with different functions. You can use `go_app() <pywebio.session.go_app>` or `put_link() <pywebio.output.put_link>` to jump between services::
 
     def task_1():
         put_text('task_1')
@@ -615,7 +615,23 @@ Use `start_server() <pywebio.platform.tornado.start_server>` to start a web serv
     start_server([index, task_1, task_2])  # or start_server({'index': index, 'task_1': task_1, 'task_2': task_2}) For more information, please refer to the function documentation.
 
 
-You can use `pywebio.platform.seo()` to set the `SEO <https://en.wikipedia.org/wiki/Search_engine_optimization>`_ information. If not ``seo()`` is not used, the `docstring <https://www.python.org/dev/peps/pep-0257/>`_ of the task function will be regarded as SEO information by default.
+Use `path_deploy() <pywebio.platform.path_deploy>` to deploy the PyWebIO applications from a directory.
+A valid python file under this directory need contain the ``main`` function as the PyWebIO application.
+You can access the application by using the file path as the URL.
+
+For example, given the following folder structure::
+
+   .
+   ├── A
+   │   └── a.py
+   ├── B
+   │   └── b.py
+   └── c.py
+
+If you use this directory in `path_deploy() <pywebio.platform.path_deploy>`, you can access the PyWebIO application in ``b.py`` by using URL ``http://<hist>:<port>/A/b``.
+And if the files have been modified after run `path_deploy() <pywebio.platform.path_deploy>`, you can use ``reload`` URL parameter to reload application in the file: ``http://<hist>:<port>/A/b?reload``
+
+In Server mode, you can use `pywebio.platform.seo()` to set the `SEO <https://en.wikipedia.org/wiki/Search_engine_optimization>`_ information. If not ``seo()`` is not used, the `docstring <https://www.python.org/dev/peps/pep-0257/>`_ of the task function will be regarded as SEO information by default.
 
 .. attention::
 

+ 145 - 110
docs/locales/zh_CN/LC_MESSAGES/guide.po

@@ -7,8 +7,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-02-21 00:26+0800\n"
-"PO-Revision-Date: 2021-02-21 00:29+0800\n"
+"POT-Creation-Date: 2021-03-14 16:01+0800\n"
+"PO-Revision-Date: 2021-03-14 16:05+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
@@ -405,18 +405,18 @@ msgstr ""
 
 #: ../../guide.rst:260
 msgid ""
-" hobby = output('Coding')  # equal to output(put_text('Coding'))\n"
-" put_table([\n"
+"hobby = output('Coding')  # equal to output(put_text('Coding'))\n"
+"put_table([\n"
 "    ['Name', 'Hobbies'],\n"
 "    ['Wang', hobby]      # hobby is initialized to Coding\n"
-" ])\n"
-" ## ----\n"
+"])\n"
+"## ----\n"
 "\n"
-" hobby.reset('Movie')  # hobby is reset to Movie\n"
-" ## ----\n"
-" hobby.append('Music', put_text('Drama'))   # append Music, Drama to hobby\n"
-" ## ----\n"
-" hobby.insert(0, put_markdown('**Coding**'))  # insert the Coding into the top of the hobby"
+"hobby.reset('Movie')  # hobby is reset to Movie\n"
+"## ----\n"
+"hobby.append('Music', put_text('Drama'))   # append Music, Drama to hobby\n"
+"## ----\n"
+"hobby.insert(0, put_markdown('**Coding**'))  # insert the Coding into the top of the hobby"
 msgstr ""
 
 #: ../../guide.rst:279
@@ -912,33 +912,30 @@ msgstr "Server模式与Script模式"
 
 #: ../../guide.rst:593
 msgid ""
-"In the :ref:`Hello, world <hello_word>` section, we already know that PyWebIO supports two modes: running as a script and using `start_server() "
-"<pywebio.platform.tornado.start_server>` to run as a web service."
+"In PyWebIO, there are two modes to run PyWebIO applications: running as a script and using `start_server() <pywebio.platform.tornado.start_server>` "
+"or `path_deploy() <pywebio.platform.path_deploy>` to run as a web service."
 msgstr ""
-"在 :ref:`Hello, world <hello_word>` 一节中,已经知道,PyWebIO支持在普通的脚本中调用和使用 `start_server() <pywebio.platform.tornado.start_server>` "
-"启动一个Web服务两种模式。"
 
-#: ../../guide.rst:595 ../../guide.rst:648
+#: ../../guide.rst:595 ../../guide.rst:664
 msgid "**Server mode**"
 msgstr "**Server模式**"
 
 #: ../../guide.rst:597
 msgid ""
-"In Server mode, PyWebIO will start a web server to continuously provide services. A task function needs to be provided. When the user accesses the "
-"service address, PyWebIO will open a new session and run the task function."
-msgstr ""
-"在Server模式下,PyWebIO会启动一个Web服务来持续性地提供服务。需要提供一个任务函数(类似于Web开发中的视图函数),当用户访问服务地址时,PyWebIO会开启一个"
-"新会话并运行任务函数。"
+"In Server mode, PyWebIO will start a web server to continuously provide services. When the user accesses the service address, PyWebIO will open a "
+"new session and run PyWebIO application in it."
+msgstr "在Server模式下,PyWebIO会启动一个Web服务来持续性地提供服务。当用户访问服务地址时,PyWebIO会开启一个新会话并运行PyWebIO应用。"
 
 #: ../../guide.rst:599
 msgid ""
-"Use `start_server() <pywebio.platform.tornado.start_server>` to start a web service. In addition to accepting a function as task function, "
-"``start_server()`` also accepts a list of task function or a dictionary of it, so that one PyWebIO Server can have multiple services with different "
+"Use `start_server() <pywebio.platform.tornado.start_server>` to start a web server and serve given PyWebIO applications on it. `start_server() "
+"<pywebio.platform.tornado.start_server>` accepts a function as PyWebIO application. In addition, `start_server() <pywebio.platform.tornado."
+"start_server>` also accepts a list of task function or a dictionary of it, so that one PyWebIO Server can have multiple services with different "
 "functions. You can use `go_app() <pywebio.session.go_app>` or `put_link() <pywebio.output.put_link>` to jump between services::"
 msgstr ""
-"使用 `start_server() <pywebio.platform.tornado.start_server>` 来启动PyWebIO的Server模式, `start_server() <pywebio.platform.tornado.start_server>` "
-"除了接收一个函数作为任务函数外,\n"
-"还支持传入函数列表或字典,从而使一个PyWebIO Server下可以有多个不同功能的服务,服务之间可以通过 `go_app() <pywebio.session.go_app>` 或 `put_link() "
+"使用 `start_server() <pywebio.platform.tornado.start_server>` 启动一个Web Server来将PyWebIO应用作为Web服务运行, `start_server() <pywebio.platform."
+"tornado.start_server>` 可以接收一个函数作为PyWebIO应用;\n"
+"也支持使用函数列表或字典,从而使一个PyWebIO Server下可以有多个不同功能的服务,服务之间可以通过 `go_app() <pywebio.session.go_app>` 或 `put_link() "
 "<pywebio.output.put_link>` 进行跳转::"
 
 #: ../../guide.rst:601
@@ -979,19 +976,50 @@ msgstr ""
 
 #: ../../guide.rst:618
 msgid ""
-"You can use `pywebio.platform.seo()` to set the `SEO <https://en.wikipedia.org/wiki/Search_engine_optimization>`_ information. If not ``seo()`` is "
-"not used, the `docstring <https://www.python.org/dev/peps/pep-0257/>`_ of the task function will be regarded as SEO information by default."
+"Use `path_deploy() <pywebio.platform.path_deploy>` to deploy the PyWebIO applications from a directory. A valid python file under this directory "
+"need contain the ``main`` function as the PyWebIO application. You can access the application by using the file path as the URL."
 msgstr ""
-"可以使用 `pywebio.platform.seo()` 函数来设置任务函数SEO信息(在被搜索引擎索引时提供的网页信息,包含应用标题和应用简介),如果不使用 ``seo()`` 函数,"
-"默认条件下,PyWebIO会将任务函数的函数注释作为SEO信息(应用标题和简介之间使用一个空行分隔)。"
 
 #: ../../guide.rst:622
+msgid "For example, given the following folder structure::"
+msgstr "例如,给定如下文件结构::"
+
+#: ../../guide.rst:624
+msgid ""
+".\n"
+"├── A\n"
+"│   └── a.py\n"
+"├── B\n"
+"│   └── b.py\n"
+"└── c.py"
+msgstr ""
+
+#: ../../guide.rst:631
+msgid ""
+"If you use this directory in `path_deploy() <pywebio.platform.path_deploy>`, you can access the PyWebIO application in ``b.py`` by using URL "
+"``http://<hist>:<port>/A/b``. And if the files have been modified after run `path_deploy() <pywebio.platform.path_deploy>`, you can use ``reload`` "
+"URL parameter to reload application in the file: ``http://<hist>:<port>/A/b?reload``"
+msgstr ""
+"如果使用以上路径调用 `path_deploy() <pywebio.platform.path_deploy>` ,你可以通过 URL ``http://<hist>:<port>/A/b`` 来访问 ``b.py`` 文件中的PyWebIO应"
+"用。当文件在运行 `path_deploy() <pywebio.platform.path_deploy>` 之后被修改,可以使用 ``reload`` URL参数来重载文件: ``http://<hist>:<port>/A/b?"
+"reload``"
+
+#: ../../guide.rst:634
+msgid ""
+"In Server mode, you can use `pywebio.platform.seo()` to set the `SEO <https://en.wikipedia.org/wiki/Search_engine_optimization>`_ information. If "
+"not ``seo()`` is not used, the `docstring <https://www.python.org/dev/peps/pep-0257/>`_ of the task function will be regarded as SEO information by "
+"default."
+msgstr ""
+"在Server模式下,可以使用 `pywebio.platform.seo()` 函数来设置任务函数SEO信息(在被搜索引擎索引时提供的网页信息,包含应用标题和应用简介),如果不使用 "
+"``seo()`` 函数,默认条件下,PyWebIO会将任务函数的函数注释作为SEO信息(应用标题和简介之间使用一个空行分隔)。"
+
+#: ../../guide.rst:638
 msgid ""
 "Note that in Server mode, PyWebIO's input and output functions can only be called in the context of task functions. For example, the following code "
 "is **not allowed**::"
 msgstr "注意,在Server模式下,仅能在任务函数上下文中对PyWebIO的交互函数进行调用。比如如下调用是 **不被允许的** ::"
 
-#: ../../guide.rst:624
+#: ../../guide.rst:640
 msgid ""
 "import pywebio\n"
 "from pywebio.input import input\n"
@@ -1000,15 +1028,15 @@ msgid ""
 "pywebio.start_server(my_task_func, port=int(port))"
 msgstr ""
 
-#: ../../guide.rst:631 ../../guide.rst:644
+#: ../../guide.rst:647 ../../guide.rst:660
 msgid "**Script mode**"
 msgstr "**Script模式**"
 
-#: ../../guide.rst:633
+#: ../../guide.rst:649
 msgid "In Script mode, PyWebIO input and output functions can be called anywhere."
 msgstr "Script模式下,在任何位置都可以调用PyWebIO的交互函数。"
 
-#: ../../guide.rst:635
+#: ../../guide.rst:651
 msgid ""
 "If the user closes the browser before the end of the session, then calls to PyWebIO input and output functions in the session will cause a "
 "`SessionException <pywebio.exceptions.SessionException>` exception."
@@ -1016,15 +1044,15 @@ msgstr ""
 "如果用户在会话结束之前关闭了浏览器,那么之后会话内对于PyWebIO交互函数的调用将会引发一个 `SessionException <pywebio.exceptions.SessionException>` 异"
 "常。"
 
-#: ../../guide.rst:640
+#: ../../guide.rst:656
 msgid "Concurrent"
 msgstr "并发"
 
-#: ../../guide.rst:642
+#: ../../guide.rst:658
 msgid "PyWebIO can be used in a multi-threading environment."
 msgstr "PyWebIO 支持在多线程环境中使用。"
 
-#: ../../guide.rst:646
+#: ../../guide.rst:662
 msgid ""
 "In Script mode, you can freely start new thread and call PyWebIO interactive functions in it. When all `non-daemonic <https://docs.python.org/3/"
 "library/threading.html#thread-objects>`_ threads finish running, the script exits."
@@ -1032,7 +1060,7 @@ msgstr ""
 "在 Script模式下,你可以自由地启动线程,并在其中调用PyWebIO的交互函数。当所有非 `Daemon线程 <https://docs.python.org/3/library/threading.html#thread-"
 "objects>`_ 运行结束后,脚本退出。"
 
-#: ../../guide.rst:650
+#: ../../guide.rst:666
 msgid ""
 "In Server mode, if you need to use PyWebIO interactive functions in new thread, you need to use `register_thread(thread) <pywebio.session."
 "register_thread>` to register the new thread (so that PyWebIO can know which session the thread belongs to). If the PyWebIO interactive function is "
@@ -1047,11 +1075,11 @@ msgstr ""
 "理,其调用PyWebIO的交互函数将会产生 `SessionNotFoundException <pywebio.exceptions.SessionNotFoundException>` 异常。\n"
 "当会话的任务函数和会话内通过 `register_thread(thread) <pywebio.session.register_thread>` 注册的线程都结束运行时,会话关闭。"
 
-#: ../../guide.rst:652
+#: ../../guide.rst:668
 msgid "Example of using multi-threading in Server mode::"
 msgstr "Server模式下多线程的使用示例::"
 
-#: ../../guide.rst:654
+#: ../../guide.rst:670
 msgid ""
 "def show_time():\n"
 "    while True:\n"
@@ -1074,11 +1102,11 @@ msgid ""
 "start_server(app, port=8080, debug=True)"
 msgstr ""
 
-#: ../../guide.rst:678 ../../guide.rst:914
+#: ../../guide.rst:694 ../../guide.rst:930
 msgid "Close of session"
 msgstr "会话的结束"
 
-#: ../../guide.rst:680
+#: ../../guide.rst:696
 msgid ""
 "The close of session may also be caused by the user closing the browser page. After the browser page is closed, PyWebIO input function calls that "
 "have not yet returned in the current session will cause `SessionClosedException <pywebio.exceptions.SessionClosedException>`, and subsequent calls "
@@ -1089,7 +1117,7 @@ msgstr ""
 "SessionClosedException>` 异常,之后对于PyWebIO交互函数的调用将会产生 `SessionNotFoundException <pywebio.exceptions.SessionNotFoundException>` 或 "
 "`SessionClosedException <pywebio.exceptions.SessionClosedException>` 异常。"
 
-#: ../../guide.rst:682
+#: ../../guide.rst:698
 msgid ""
 "You can use `defer_call(func) <pywebio.session.defer_call>` to set the function to be called when the session closes. Whether it is because the "
 "user closes the page or the task finishes to cause session closed, the function set by `defer_call(func) <pywebio.session.defer_call>` will be "
@@ -1101,33 +1129,33 @@ msgstr ""
 "`defer_call(func) <pywebio.session.defer_call>` 可以用于资源清理等工作。在会话中可以多次调用 `defer_call() <pywebio.session.defer_call>` ,会话结束后"
 "将会顺序执行设置的函数。"
 
-#: ../../guide.rst:687
+#: ../../guide.rst:703
 msgid "Integration with web framework"
 msgstr "与Web框架集成"
 
-#: ../../guide.rst:689
+#: ../../guide.rst:705
 msgid ""
 "The PyWebIO application can be integrated into an existing Python Web project, and the PyWebIO application and the Web project share a web "
 "framework. PyWebIO currently supports integration with Flask, Tornado, Django and aiohttp web frameworks."
 msgstr "可以将PyWebIO应用集成到现有的Python Web项目中,PyWebIO应用与Web项目共用一个Web框架。目前支持与Flask、Tornado、Django和aiohttp Web框架的集成。"
 
-#: ../../guide.rst:691
+#: ../../guide.rst:707
 msgid "The integration methods of different web frameworks are as follows:"
 msgstr "不同Web框架的集成方法如下:"
 
-#: ../../guide.rst:695
+#: ../../guide.rst:711
 msgid "Tornado"
 msgstr ""
 
-#: ../../guide.rst:699
+#: ../../guide.rst:715
 msgid "**Tornado**"
 msgstr ""
 
-#: ../../guide.rst:701
+#: ../../guide.rst:717
 msgid "Need to add a ``RequestHandler`` to Tornado application::"
 msgstr "需要在Tornado应用中引入一个 ``RequestHandler`` ::"
 
-#: ../../guide.rst:703
+#: ../../guide.rst:719
 msgid ""
 "import tornado.ioloop\n"
 "import tornado.web\n"
@@ -1147,7 +1175,7 @@ msgid ""
 "    tornado.ioloop.IOLoop.current().start()"
 msgstr ""
 
-#: ../../guide.rst:721
+#: ../../guide.rst:737
 msgid ""
 "In above code, we use `webio_handler(task_func) <pywebio.platform.tornado.webio_handler>` to get the Tornado `WebSocketHandler <https://www."
 "tornadoweb.org/en/stable/websocket.html#tornado.websocket.WebSocketHandler>`_  that communicates with the browser, and bind it to the ``/tool`` "
@@ -1157,7 +1185,7 @@ msgstr ""
 "www.tornadoweb.org/en/stable/websocket.html#tornado.websocket.WebSocketHandler>`_ ,并将其绑定在 ``/tool`` 路由下。启动Tornado服务器后,访问 "
 "``http://localhost/tool`` 即可打开PyWebIO应用。"
 
-#: ../../guide.rst:725
+#: ../../guide.rst:741
 msgid ""
 "PyWebIO uses the WebSocket protocol to communicate with the browser in Tornado. If your Tornado application is behind a reverse proxy (such as "
 "Nginx), you may need to configure the reverse proxy to support the WebSocket protocol. :ref:`Here <nginx_ws_config>` is an example of Nginx "
@@ -1166,19 +1194,19 @@ msgstr ""
 "当使用Tornado后端时,PyWebIO使用WebSocket协议和浏览器进行通讯,如果你的Tornado应用处在反向代理(比如Nginx)之后,可能需要特别配置反向代理来支持"
 "WebSocket协议,:ref:`这里 <nginx_ws_config>` 有一个Nginx配置WebSocket的例子。"
 
-#: ../../guide.rst:727
+#: ../../guide.rst:743
 msgid "Flask"
 msgstr ""
 
-#: ../../guide.rst:731
+#: ../../guide.rst:747
 msgid "**Flask**"
 msgstr ""
 
-#: ../../guide.rst:733
+#: ../../guide.rst:749
 msgid "One route need to be added to communicate with the browser through HTTP::"
 msgstr "需要添加一个PyWebIO相关的路由,用来和浏览器进行Http通讯::"
 
-#: ../../guide.rst:735
+#: ../../guide.rst:751
 msgid ""
 "from pywebio.platform.flask import webio_view\n"
 "from pywebio import STATIC_PATH\n"
@@ -1193,7 +1221,7 @@ msgid ""
 "app.run(host='localhost', port=80)"
 msgstr ""
 
-#: ../../guide.rst:748
+#: ../../guide.rst:764
 msgid ""
 "In above code, we use `webio_view(task_func) <pywebio.platform.flask.webio_view>` to get the Flask view of the PyWebIO application, and bind it to "
 "``/tool`` path. After starting the Flask application, visit ``http://localhost/tool`` to open the PyWebIO application."
@@ -1202,19 +1230,19 @@ msgstr ""
 "flask.palletsprojects.com/en/1.1.x/api/#flask.Flask.add_url_rule>`_ 将其绑定在 ``/tool`` 路径下。启动Flask应用后,访问 ``http://localhost/tool`` 即"
 "可打开PyWebIO应用。"
 
-#: ../../guide.rst:750
+#: ../../guide.rst:766
 msgid "Django"
 msgstr ""
 
-#: ../../guide.rst:754
+#: ../../guide.rst:770
 msgid "**Django**"
 msgstr ""
 
-#: ../../guide.rst:756
+#: ../../guide.rst:772
 msgid "Need to add a route in ``urls.py``::"
 msgstr "在django的路由配置文件 ``urls.py`` 中加入PyWebIO相关的路由即可::"
 
-#: ../../guide.rst:758
+#: ../../guide.rst:774
 msgid ""
 "# urls.py\n"
 "\n"
@@ -1232,7 +1260,7 @@ msgid ""
 "]"
 msgstr ""
 
-#: ../../guide.rst:774
+#: ../../guide.rst:790
 msgid ""
 "In above code, we add a routing rule to bind the view function of the PyWebIO application to the ``/tool`` path After starting the Django server, "
 "visit ``http://localhost/tool`` to open the PyWebIO application"
@@ -1240,19 +1268,19 @@ msgstr ""
 "以上代码使用添加了一条路由规则将PyWebIO应用的视图函数绑定到 ``/tool`` 路径下。\n"
 "启动Django应用后,访问 ``http://localhost/tool`` 即可打开PyWebIO应用"
 
-#: ../../guide.rst:777
+#: ../../guide.rst:793
 msgid "aiohttp"
 msgstr ""
 
-#: ../../guide.rst:781
+#: ../../guide.rst:797
 msgid "**aiohttp**"
 msgstr ""
 
-#: ../../guide.rst:783
+#: ../../guide.rst:799
 msgid "One route need to be added to communicate with the browser through WebSocket:::"
 msgstr "需要添加一个PyWebIO相关的路由,用来和浏览器进行WebSocket通讯::"
 
-#: ../../guide.rst:785
+#: ../../guide.rst:801
 msgid ""
 "from aiohttp import web\n"
 "from pywebio.platform.aiohttp import static_routes, webio_handler\n"
@@ -1264,11 +1292,11 @@ msgid ""
 "web.run_app(app, host='localhost', port=80)"
 msgstr ""
 
-#: ../../guide.rst:794
+#: ../../guide.rst:810
 msgid "After starting the aiohttp server, visit ``http://localhost/tool`` to open the PyWebIO application"
 msgstr "启动aiohttp应用后,访问 ``http://localhost/tool`` 即可打开PyWebIO应用"
 
-#: ../../guide.rst:798
+#: ../../guide.rst:814
 msgid ""
 "PyWebIO uses the WebSocket protocol to communicate with the browser in aiohttp. If your aiohttp server is behind a reverse proxy (such as Nginx), "
 "you may need to configure the reverse proxy to support the WebSocket protocol. :ref:`Here <nginx_ws_config>` is an example of Nginx WebSocket "
@@ -1277,15 +1305,15 @@ msgstr ""
 "当使用aiohttp后端时,PyWebIO使用WebSocket协议和浏览器进行通讯,如果你的aiohttp应用处在反向代理(比如Nginx)之后,\n"
 "可能需要特别配置反向代理来支持WebSocket协议,:ref:`这里 <nginx_ws_config>` 有一个Nginx配置WebSocket的例子。"
 
-#: ../../guide.rst:803
+#: ../../guide.rst:819
 msgid "Notes"
 msgstr ""
 
-#: ../../guide.rst:804
+#: ../../guide.rst:820
 msgid "**Static resources Hosting**"
 msgstr "**PyWebIO静态资源的托管**"
 
-#: ../../guide.rst:806
+#: ../../guide.rst:822
 msgid ""
 "By default, the front-end of PyWebIO gets required static resources from CDN. If you want to deploy PyWebIO applications in an offline environment, "
 "you need to host static files by yourself, and set the ``cdn`` parameter of ``webio_view()`` or ``webio_handler()`` to ``False``."
@@ -1293,7 +1321,7 @@ msgstr ""
 "PyWebIO默认使用CDN来获取前端的静态资源,如果要将PyWebIO应用部署到离线环境中,需要自行托管静态文件,\n"
 "并将 ``webio_view()`` 或 ``webio_handler()`` 的 ``cdn`` 参数设置为 ``False`` 。"
 
-#: ../../guide.rst:808
+#: ../../guide.rst:824
 msgid ""
 "When setting ``cdn=False`` , you need to host the static resources in the same directory as the PyWebIO application. In addition, you can also pass "
 "a string to ``cdn`` parameter to directly set the deployment directory of PyWebIO static resources."
@@ -1301,30 +1329,30 @@ msgstr ""
 "``cdn=False``  时需要将静态资源托管在和PyWebIO应用同级的目录下。\n"
 "同时,也可以通过 ``cdn`` 参数直接设置PyWebIO静态资源的部署目录。"
 
-#: ../../guide.rst:811
+#: ../../guide.rst:827
 msgid ""
 "The path of the static file of PyWebIO is stored in ``pywebio.STATIC_PATH``, you can use the command ``python3 -c \"import pywebio; print(pywebio."
 "STATIC_PATH)\"`` to print it out."
 msgstr ""
 "PyWebIO的静态文件的路径保存在 ``pywebio.STATIC_PATH`` 中,可使用命令 ``python3 -c \"import pywebio; print(pywebio.STATIC_PATH)\"`` 将其打印出来。"
 
-#: ../../guide.rst:813
+#: ../../guide.rst:829
 msgid ""
 "``start_server()`` also support ``cdn`` parameter, if it is set to ``False``, the static resource will be hosted in local server automatically, "
 "without manual hosting."
 msgstr "使用 ``start_server()`` 启动的应用,如果将 ``cdn`` 参数设置为 ``False`` ,会自动启动一个本地的静态资源托管服务,无需手动托管。"
 
-#: ../../guide.rst:819
+#: ../../guide.rst:835
 msgid "Coroutine-based session"
 msgstr "基于协程的会话"
 
-#: ../../guide.rst:821
+#: ../../guide.rst:837
 msgid ""
 "This section will introduce the advanced features of PyWebIO --- coroutine-based session. In most cases, you don’t need it. All functions or "
 "methods in PyWebIO that are only used for coroutine sessions are specifically noted in the document."
 msgstr "关于协程内容属于高级特性,您不必使用此部分也可以实现PyWebIO支持的全部功能。PyWebIO中所有仅用于协程会话的函数或方法都在文档中有特别说明。"
 
-#: ../../guide.rst:823
+#: ../../guide.rst:839
 msgid ""
 "PyWebIO's session is based on thread by default. Each time a user opens a session connection to the server, PyWebIO will start a thread to run the "
 "task function. In addition to thread-based sessions, PyWebIO also provides coroutine-based sessions. Coroutine-based sessions accept coroutine "
@@ -1333,7 +1361,7 @@ msgstr ""
 "PyWebIO的会话实现默认是基于线程的,用户每打开一个和服务端的会话连接,PyWebIO会启动一个线程来运行任务函数。\n"
 "除了基于线程的会话,PyWebIO还提供了基于协程的会话。基于协程的会话接受协程函数作为任务函数。"
 
-#: ../../guide.rst:825
+#: ../../guide.rst:841
 msgid ""
 "The session based on the coroutine is a single-thread model, which means that all sessions run in a single thread. For IO-bound tasks, coroutines "
 "take up fewer resources than threads and have performance comparable to threads. In addition, the context switching of the coroutine is "
@@ -1342,17 +1370,17 @@ msgstr ""
 "基于协程的会话为单线程模型,所有会话都运行在一个线程内。对于IO密集型的任务,协程比线程占用更少的资源同时又拥有媲美于线程的性能。\n"
 "另外,协程的上下文切换具有可预测性,能够减少程序同步与加锁的需要,可以有效避免大多数临界区问题。"
 
-#: ../../guide.rst:828
+#: ../../guide.rst:844
 msgid "Using coroutine session"
 msgstr "使用协程会话"
 
-#: ../../guide.rst:830
+#: ../../guide.rst:846
 msgid ""
 "To use coroutine-based session, you need to use the ``async`` keyword to declare the task function as a coroutine function, and use the ``await`` "
 "syntax to call the PyWebIO input function:"
 msgstr "要使用基于协程的会话,需要使用 ``async`` 关键字将任务函数声明为协程函数,并使用 ``await`` 语法调用PyWebIO输入函数:"
 
-#: ../../guide.rst:832
+#: ../../guide.rst:848
 #, python-format
 msgid ""
 " from pywebio.input import *\n"
@@ -1366,7 +1394,7 @@ msgid ""
 " start_server(say_hello, auto_open_webbrowser=True)"
 msgstr ""
 
-#: ../../guide.rst:846
+#: ../../guide.rst:862
 msgid ""
 "In the coroutine task function, you can also use ``await`` to call other coroutines or ( `awaitable objects <https://docs.python.org/3/library/"
 "asyncio-task.html#asyncio-awaitables>`_ ) in the standard library `asyncio <https://docs.python.org/3/library/asyncio.html>`_:"
@@ -1374,7 +1402,7 @@ msgstr ""
 "在协程任务函数中,也可以使用 ``await`` 调用其他协程或标准库 `asyncio <https://docs.python.org/3/library/asyncio.html>`_ 中的可等待对象( `awaitable "
 "objects <https://docs.python.org/3/library/asyncio-task.html#asyncio-awaitables>`_ ):"
 
-#: ../../guide.rst:848
+#: ../../guide.rst:864
 msgid ""
 " import asyncio\n"
 " from pywebio import start_server\n"
@@ -1391,7 +1419,7 @@ msgid ""
 " start_server(main, auto_open_webbrowser=True)"
 msgstr ""
 
-#: ../../guide.rst:867
+#: ../../guide.rst:883
 msgid ""
 "In coroutine-based session, all input functions defined in the :doc:`pywebio.input </input>` module need to use ``await`` syntax to get the return "
 "value. Forgetting to use ``await`` will be a common error when using coroutine-based session."
@@ -1399,47 +1427,47 @@ msgstr ""
 "在基于协程的会话中, :doc:`pywebio.input </input>` 模块中的定义输入函数都需要使用 ``await`` 语法来获取返回值,忘记使用 ``await`` 将会是在使用基于协"
 "程的会话时常出现的错误。"
 
-#: ../../guide.rst:869
+#: ../../guide.rst:885
 msgid "Other functions that need to use ``await`` syntax in the coroutine session are:"
 msgstr "其他在协程会话中也需要使用 ``await`` 语法来进行调用函数有:"
 
-#: ../../guide.rst:871
+#: ../../guide.rst:887
 msgid "`pywebio.session.run_asyncio_coroutine(coro_obj) <pywebio.session.run_asyncio_coroutine>`"
 msgstr ""
 
-#: ../../guide.rst:872
+#: ../../guide.rst:888
 msgid "`pywebio.session.eval_js(expression) <pywebio.session.eval_js>`"
 msgstr ""
 
-#: ../../guide.rst:873
+#: ../../guide.rst:889
 msgid "`pywebio.session.hold() <pywebio.session.hold>`"
 msgstr ""
 
-#: ../../guide.rst:877
+#: ../../guide.rst:893
 msgid ""
 "Although the PyWebIO coroutine session is compatible with the ``awaitable objects`` in the standard library ``asyncio``, the ``asyncio`` library is "
 "not compatible with the ``awaitable objects`` in the PyWebIO coroutine session."
 msgstr "虽然PyWebIO的协程会话兼容标准库 ``asyncio`` 中的 ``awaitable objects`` ,但 ``asyncio`` 库不兼容PyWebIO协程会话中的 ``awaitable objects`` ."
 
-#: ../../guide.rst:879
+#: ../../guide.rst:895
 msgid ""
 "That is to say, you can't pass PyWebIO ``awaitable objects`` to the `asyncio`` functions that accept ``awaitable objects``. For example, the "
 "following calls are **not supported** ::"
 msgstr ""
 "也就是说,无法将PyWebIO中的 ``awaitable objects`` 传入 ``asyncio`` 中的接受 ``awaitable objects`` 作为参数的函数中,比如如下调用是 **不被支持的** ::"
 
-#: ../../guide.rst:881
+#: ../../guide.rst:897
 msgid ""
 "await asyncio.shield(pywebio.input())\n"
 "await asyncio.gather(asyncio.sleep(1), pywebio.session.eval_js('1+1'))\n"
 "task = asyncio.create_task(pywebio.input())"
 msgstr ""
 
-#: ../../guide.rst:888
+#: ../../guide.rst:904
 msgid "Concurrency in coroutine-based sessions"
 msgstr "协程会话的并发"
 
-#: ../../guide.rst:890
+#: ../../guide.rst:906
 msgid ""
 "In coroutine-based session, you can start new thread, but you cannot call PyWebIO interactive functions in it (`register_thread() <pywebio.session."
 "register_thread>` is not available in coroutine session). But you can use `run_async(coro) <pywebio.session.run_async>` to execute a coroutine "
@@ -1449,7 +1477,7 @@ msgstr ""
 "用)。\n"
 "但你可以使用 `run_async(coro) <pywebio.session.run_async>` 来异步执行一个协程对象,新协程内可以使用PyWebIO交互函数:"
 
-#: ../../guide.rst:892
+#: ../../guide.rst:908
 msgid ""
 " from pywebio import start_server\n"
 " from pywebio.session import run_async\n"
@@ -1467,7 +1495,7 @@ msgid ""
 " start_server(main, auto_open_webbrowser=True)"
 msgstr ""
 
-#: ../../guide.rst:911
+#: ../../guide.rst:927
 msgid ""
 "`run_async(coro) <pywebio.session.run_async>` returns a `TaskHandler <pywebio.session.coroutinebased.TaskHandler>`, which can be used to query the "
 "running status of the coroutine or close the coroutine."
@@ -1475,13 +1503,13 @@ msgstr ""
 "`run_async(coro) <pywebio.session.run_async>` 返回一个 `TaskHandler <pywebio.session.coroutinebased.TaskHandler>` ,通过该 `TaskHandler <pywebio."
 "session.coroutinebased.TaskHandler>` 可以查询协程运行状态和关闭协程。"
 
-#: ../../guide.rst:916
+#: ../../guide.rst:932
 msgid ""
 "Similar to thread-based session, in coroutine-based session, when the task function and the coroutine running through `run_async() <pywebio.session."
 "run_async>` in the session are all finished, the session is closed."
 msgstr "与基于线程的会话类似,在基于协程的会话中,当任务函数和在会话内通过 `run_async() <pywebio.session.run_async>` 运行的协程全部结束后,会话关闭。"
 
-#: ../../guide.rst:918
+#: ../../guide.rst:934
 msgid ""
 "If the close of the session is caused by the user closing the browser, the behavior of PyWebIO is the same as :ref:`Thread-based session "
 "<session_close>`: After the browser page closed, PyWebIO input function calls that have not yet returned in the current session will cause "
@@ -1493,23 +1521,23 @@ msgstr ""
 "的调用将会产生 `SessionNotFoundException <pywebio.exceptions.SessionNotFoundException>` 或 `SessionClosedException <pywebio.exceptions."
 "SessionClosedException>` 异常。"
 
-#: ../../guide.rst:920
+#: ../../guide.rst:936
 msgid "`defer_call(func) <pywebio.session.defer_call>` also available in coroutine session."
 msgstr "协程会话也同样支持使用 `defer_call(func) <pywebio.session.defer_call>` 来设置会话结束时需要调用的函数。"
 
-#: ../../guide.rst:925
+#: ../../guide.rst:941
 msgid "Integration with Web Framework"
 msgstr "协程会话与Web框架集成"
 
-#: ../../guide.rst:927
+#: ../../guide.rst:943
 msgid "The PyWebIO application that using coroutine-based session can also be integrated to the web framework."
 msgstr "基于协程的会话同样可以与Web框架进行集成,只需要在原来传入任务函数的地方改为传入协程函数即可。"
 
-#: ../../guide.rst:929
+#: ../../guide.rst:945
 msgid "However, there are some limitations when using coroutine-based sessions to integrate into Flask or Django:"
 msgstr "但当前在使用基于协程的会话集成进Flask或Django时,存在一些限制:"
 
-#: ../../guide.rst:931
+#: ../../guide.rst:947
 msgid ""
 "First, when ``await`` the coroutine objects/awaitable objects in the ``asyncio`` module, you need to use `run_asyncio_coroutine() <pywebio.session."
 "run_asyncio_coroutine>` to wrap the coroutine object."
@@ -1517,15 +1545,15 @@ msgstr ""
 "一是协程函数内还无法直接通过 ``await`` 直接等待asyncio库中的协程对象,目前需要使用 `run_asyncio_coroutine() <pywebio.session."
 "run_asyncio_coroutine>` 进行包装。"
 
-#: ../../guide.rst:933
+#: ../../guide.rst:949
 msgid "Secondly, you need to start a new thread to run the event loop before starting a Flask/Django server."
 msgstr "二是,在启动Flask/Django这类基于线程的服务器之前需要启动一个单独的线程来运行事件循环。"
 
-#: ../../guide.rst:935
+#: ../../guide.rst:951
 msgid "Example of coroutine-based session integration into Flask:"
 msgstr "使用基于协程的会话集成进Flask的示例:"
 
-#: ../../guide.rst:937
+#: ../../guide.rst:953
 msgid ""
 " import asyncio\n"
 " import threading\n"
@@ -1550,21 +1578,21 @@ msgid ""
 " app.run(host='localhost', port=80)"
 msgstr ""
 
-#: ../../guide.rst:962
+#: ../../guide.rst:978
 msgid ""
 "Finally, coroutine-based session is not available in the Script mode. You always need to use ``start_server()`` to run coroutine task function or "
 "integrate it to a web framework."
 msgstr "最后,使用PyWebIO编写的协程函数不支持Script模式,总是需要使用 ``start_server`` 来启动一个服务或者集成进Web框架来调用。"
 
-#: ../../guide.rst:965
+#: ../../guide.rst:981
 msgid "Last but not least"
 msgstr ""
 
-#: ../../guide.rst:967
+#: ../../guide.rst:983
 msgid "This is all features of PyWebIO, you can continue to read the rest of the documents, or start writing your PyWebIO applications now."
 msgstr "以上就是PyWebIO的全部功能了,你可以继续阅读接下来的文档,或者立即开始PyWebIO应用的编写了。"
 
-#: ../../guide.rst:969
+#: ../../guide.rst:985
 msgid ""
 "Finally, please allow me to provide one more suggestion. When you encounter a design problem when using PyWebIO, you can ask yourself a question: "
 "What would I do if it is in a terminal program? If you already have the answer, it can be done in the same way with PyWebIO. If the problem "
@@ -1574,6 +1602,13 @@ msgstr ""
 "如果你已经有答案了,那么在PyWebIO中一样可以使用这样的方式完成。如果问题依然存在或者觉得解决方案不够好,\n"
 "你可以考虑使用 `put_buttons() <pywebio.output.put_buttons>` 提供的回调机制。"
 
-#: ../../guide.rst:972
+#: ../../guide.rst:988
 msgid "OK, Have fun with PyWebIO!"
 msgstr ""
+
+#~ msgid ""
+#~ "In the :ref:`Hello, world <hello_word>` section, we already know that PyWebIO supports two modes: running as a script and using `start_server() "
+#~ "<pywebio.platform.tornado.start_server>` to run as a web service."
+#~ msgstr ""
+#~ "在 :ref:`Hello, world <hello_word>` 一节中,已经知道,PyWebIO支持在普通的脚本中调用和使用 `start_server() <pywebio.platform.tornado."
+#~ "start_server>` 启动一个Web服务两种模式。"

+ 308 - 123
docs/locales/zh_CN/LC_MESSAGES/platform.po

@@ -7,8 +7,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-03-11 23:06+0800\n"
-"PO-Revision-Date: 2021-03-11 23:10+0800\n"
+"POT-Creation-Date: 2021-03-14 16:17+0800\n"
+"PO-Revision-Date: 2021-03-14 16:20+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
@@ -20,24 +20,173 @@ msgstr ""
 "X-Generator: Poedit 2.4.2\n"
 
 #: ../../platform.rst:2
-msgid "``pywebio.platform`` --- Support to Web framework"
-msgstr "``pywebio.platform`` — Web框架支持"
+msgid "``pywebio.platform`` --- Deploy applications"
+msgstr "``pywebio.platform`` — 应用部署"
 
 #: of pywebio.platform:1
-msgid "The ``platform`` module provides support for different web frameworks."
-msgstr "``platform`` 模块为PyWebIO提供了对不同Web框架的支持。"
+msgid ""
+"The ``platform`` module provides support for deploying PyWebIO applications in "
+"different web frameworks."
+msgstr "``platform`` 模块为PyWebIO提供了在不同Web框架中运行PyWebIO应用的支持。"
+
+#: of pywebio.platform:5
+msgid ":ref:`Integration with Web Framework <integration_web_framework>`"
+msgstr ":ref:`与Web框架集成 <integration_web_framework>`"
+
+#: of pywebio.platform:7
+msgid ":ref:`Server mode and Script mode <server_and_script_mode>`"
+msgstr ":ref:`Server模式与Script模式 <server_and_script_mode>`"
+
+#: of pywebio.platform:10
+msgid "Directory Deploy"
+msgstr ""
+
+#: of pywebio.platform:12
+msgid ""
+"You can use ``path_deploy()`` or ``path_deploy_http()`` to deploy the PyWebIO "
+"applications from a directory. You can access the application by using the file "
+"path as the URL."
+msgstr ""
+"可以使用 ``path_deploy()`` 或 ``path_deploy_http()`` 来从一个路径中部署PyWebIO应"
+"用。服务端会根据用户访问的URL来确定需要加载的文件并从中读取PyWebIO应用来运行。"
+
+#: of pywebio.platform.path_deploy:1 pywebio.platform.path_deploy_http:1
+msgid "Deploy the PyWebIO applications from a directory."
+msgstr "从一个路径中部署PyWebIO应用"
 
-#: of pywebio.platform:3
+#: of pywebio.platform.path_deploy:3
+msgid "The server communicates with the browser using WebSocket protocol."
+msgstr "服务端使用WebSocket协议与浏览器进行通讯。"
+
+#: of pywebio.platform.aiohttp.start_server pywebio.platform.django.start_server
+#: pywebio.platform.flask.start_server pywebio.platform.path_deploy
+#: pywebio.platform.run_event_loop pywebio.platform.seo
+#: pywebio.platform.tornado.start_server pywebio.platform.tornado_http.start_server
+msgid "Parameters"
+msgstr ""
+
+#: of pywebio.platform.path_deploy:5
+msgid "Base directory to load PyWebIO application."
+msgstr "用于加载PyWebIO应用的根目录"
+
+#: of pywebio.platform.path_deploy:6
+msgid "The port the server listens on."
+msgstr "服务器监听的端口"
+
+#: of pywebio.platform.path_deploy:7
+msgid "The host the server listens on."
+msgstr "服务绑定的地址"
+
+#: of pywebio.platform.path_deploy:8
 msgid ""
-"See also: :ref:`Integration with Web Framework <integration_web_framework>` "
-"section of user manual."
-msgstr "具体用法参见用户手册 :ref:`与Web框架集成 <integration_web_framework>` 小节"
+"Whether to provide a default index page when request a directory, default is "
+"``True``. ``index`` also accepts a function to custom index page, which receives "
+"the requested directory path as parameter and return HTML content in string.  You "
+"can override the index page by add a `index.py` PyWebIO app file to the directory."
+msgstr ""
+"当请求一个文件夹时是否显示默认的索引页面,默认为 ``True`` 。 ``index`` 也可以为一个"
+"函数来自定义索引页面,其接收请求的文件夹路径作为参数,返回页面HTML字符串。你可以在"
+"文件夹中创建一个 `index.py` PyWebIO应用文件来重写文件夹的索引页。"
+
+#: of pywebio.platform.path_deploy:8
+msgid ""
+"Whether to provide a default index page when request a directory, default is "
+"``True``. ``index`` also accepts a function to custom index page, which receives "
+"the requested directory path as parameter and return HTML content in string."
+msgstr ""
+"当请求一个文件夹时是否显示默认的索引页面,默认为 ``True`` 。 ``index`` 也可以为一个"
+"函数来自定义索引页面,其接收请求的文件夹路径作为参数,返回页面HTML字符串"
+
+#: of pywebio.platform.path_deploy:11
+msgid ""
+"You can override the index page by add a `index.py` PyWebIO app file to the "
+"directory."
+msgstr ""
+
+#: of pywebio.platform.path_deploy:12
+msgid ""
+"Directory to store the application static files. The files in this directory can "
+"be accessed via ``http://<host>:<port>/static/files``. For example, if there is a "
+"``A/B.jpg`` file in ``http_static_dir`` path, it can be accessed via ``http://"
+"<host>:<port>/static/A/B.jpg``."
+msgstr ""
+"应用静态文件目录。目录下的文件可以通过 ``http://<host>:<port>/static/files`` 访问。"
+"例如 ``http_static_dir`` 路径下存在文件 ``A/B.jpg`` ,则其URL为 ``http://<host>:"
+"<port>/static/A/B.jpg``。"
+
+#: of pywebio.platform.path_deploy:17
+msgid ""
+"The rest arguments of ``path_deploy()`` have the same meaning as for :func:"
+"`pywebio.platform.tornado.start_server`"
+msgstr ""
+"剩余参数的详细说明见 :func:`pywebio.platform.tornado.start_server` 的同名参数。"
 
-#: of pywebio.platform:6
+#: of pywebio.platform.path_deploy_http:3
+msgid "The server communicates with the browser using HTTP protocol."
+msgstr "服务端使用HTTP协议与浏览器进行通讯。"
+
+#: of pywebio.platform.path_deploy_http:5
+msgid ""
+"The ``base``, ``port``, ``host``, ``index``, ``static_dir`` arguments of "
+"``path_deploy_http()`` have the same meaning as for :func:`pywebio.platform."
+"path_deploy.path_deploy`"
+msgstr ""
+"关于 ``path_deploy_http()`` 的 ``base``, ``port``, ``host``, ``index``, "
+"``static_dir`` 参数的详细说明见 :func:`pywebio.platform.path_deploy.path_deploy` 的"
+"同名参数。"
+
+#: of pywebio.platform.path_deploy_http:8
+msgid ""
+"The rest arguments of ``path_deploy_http()`` have the same meaning as for :func:"
+"`pywebio.platform.tornado_http.start_server`"
+msgstr ""
+"剩余参数的详细说明见 :func:`pywebio.platform.tornado_http.start_server` 的同名参"
+"数。"
+
+#: of pywebio.platform:19
+msgid "Application Deploy"
+msgstr ""
+
+#: of pywebio.platform:21
+msgid ""
+"The ``start_server()`` functions can start a Python Web server and serve given "
+"PyWebIO applications on it."
+msgstr "``start_server()`` 函数可以启动一个Web服务器来将PyWebIO应用作为Web服务运行。"
+
+#: of pywebio.platform:23
+msgid ""
+"The ``webio_handler()`` and ``webio_view()`` functions can be used to integrate "
+"PyWebIO applications into existing Python Web project."
+msgstr ""
+"``webio_handler()`` 和 ``webio_view()`` 函数用于将PyWebIO应用整合到现有的Python Web"
+"项目中。"
+
+#: of pywebio.platform:27
+msgid ""
+"Added the ``cdn`` parameter in ``start_server()``, ``webio_handler()`` and "
+"``webio_view()``."
+msgstr ""
+
+#: of pywebio.platform:31
+msgid "Added the ``static_dir`` parameter in ``start_server()``."
+msgstr ""
+
+#: of pywebio.platform:34
 msgid "Tornado support"
 msgstr "Tornado相关"
 
+#: of pywebio.platform:36
+msgid ""
+"There are two protocols (WebSocket and HTTP) can be used to communicates with the "
+"browser:"
+msgstr "服务端可以通过两种协议(WebSocket 和 HTTP)来与用户浏览器通信。"
+
+#: of pywebio.platform:39
+msgid "WebSocket"
+msgstr ""
+
 #: of pywebio.platform.tornado.start_server:1
+#: pywebio.platform.tornado_http.start_server:1
 msgid "Start a Tornado server to provide the PyWebIO application as a web service."
 msgstr "启动一个 Tornado server 将PyWebIO应用作为Web服务提供。"
 
@@ -54,14 +203,6 @@ msgstr ""
 "Tornado为PyWebIO应用的默认后端Server,可以直接使用 ``from pywebio import "
 "start_server`` 导入。"
 
-#: of pywebio.platform.aiohttp.start_server pywebio.platform.aiohttp.webio_handler
-#: pywebio.platform.django.start_server pywebio.platform.django.webio_view
-#: pywebio.platform.flask.start_server pywebio.platform.flask.webio_view
-#: pywebio.platform.run_event_loop pywebio.platform.seo
-#: pywebio.platform.tornado.start_server
-msgid "Parameters"
-msgstr ""
-
 #: of pywebio.platform.tornado.start_server:8
 msgid ""
 "PyWebIO application. Can be a task function, a list of functions, or a "
@@ -110,15 +251,13 @@ msgstr ""
 "任务函数为协程函数时,使用 :ref:`基于协程的会话实现 <coroutine_based_session>` ;任"
 "务函数为普通函数时,使用基于线程的会话实现。"
 
-#: of pywebio.platform.aiohttp.start_server:5 pywebio.platform.django.start_server:5
-#: pywebio.platform.flask.start_server:5 pywebio.platform.tornado.start_server:20
+#: of pywebio.platform.tornado.start_server:20
 msgid ""
 "The port the server listens on. When set to ``0``, the server will automatically "
 "select a available port."
 msgstr "服务监听的端口。设置为 ``0`` 时,表示自动选择可用端口。"
 
-#: of pywebio.platform.aiohttp.start_server:7 pywebio.platform.django.start_server:7
-#: pywebio.platform.flask.start_server:7 pywebio.platform.tornado.start_server:22
+#: of pywebio.platform.tornado.start_server:22
 msgid ""
 "The host the server listens on. ``host`` may be either an IP address or hostname. "
 "If it’s a hostname, the server will listen on all IP addresses associated with the "
@@ -139,10 +278,7 @@ msgstr ""
 "详情请参阅 `tornado 文档 <https://www.tornadoweb.org/en/stable/guide/running."
 "html#debug-mode>`_"
 
-#: of pywebio.platform.aiohttp.start_server:9
-#: pywebio.platform.aiohttp.webio_handler:5 pywebio.platform.django.start_server:8
-#: pywebio.platform.django.webio_view:5 pywebio.platform.flask.start_server:8
-#: pywebio.platform.flask.webio_view:5 pywebio.platform.tornado.start_server:25
+#: of pywebio.platform.tornado.start_server:25
 msgid ""
 "Whether to load front-end static resources from CDN, the default is ``True``. Can "
 "also use a string to directly set the url of PyWebIO static resources."
@@ -150,9 +286,7 @@ msgstr ""
 "是否从CDN加载前端静态资源,默认为 ``True`` 。支持传入自定义的URL来指定静态资源的部"
 "署地址"
 
-#: of pywebio.platform.aiohttp.start_server:11
-#: pywebio.platform.django.start_server:10 pywebio.platform.flask.start_server:10
-#: pywebio.platform.tornado.start_server:27
+#: of pywebio.platform.tornado.start_server:27
 msgid ""
 "The directory to store the application static files. The files in this directory "
 "can be accessed via ``http://<host>:<port>/static/files``. For example, if there "
@@ -220,8 +354,7 @@ msgstr ""
 "返回 ``True/False`` 指示服务器接受/拒绝该请求。若设置了 ``check_origin`` , "
 "``allowed_origins`` 参数将被忽略"
 
-#: of pywebio.platform.aiohttp.start_server:19
-#: pywebio.platform.tornado.start_server:46
+#: of pywebio.platform.tornado.start_server:46
 msgid ""
 "Whether or not auto open web browser when server is started (if the operating "
 "system allows it) ."
@@ -283,11 +416,59 @@ msgid ""
 msgstr ""
 "关于各参数的详细说明见 :func:`pywebio.platform.tornado.start_server` 的同名参数。"
 
-#: of pywebio.platform:11
+#: of pywebio.platform:45
+msgid "HTTP"
+msgstr ""
+
+#: of pywebio.platform.tornado_http.start_server:3
+msgid "The Tornado server communicates with the browser by HTTP protocol."
+msgstr "服务端使用HTTP协议与浏览器进行通讯。"
+
+#: of pywebio.platform.tornado_http.start_server:5
+msgid ""
+"Session expiration time, in seconds(default 60s). If no client message is received "
+"within ``session_expire_seconds``, the session will be considered expired."
+msgstr ""
+"会话过期时间,单位为秒(默认60秒)。若 session_expire_seconds 秒内没有收到客户端的"
+"请求,则认为会话过期。"
+
+#: of pywebio.platform.tornado_http.start_server:7
+msgid ""
+"Session cleanup interval, in seconds(default 120s). The server will periodically "
+"clean up expired sessions and release the resources occupied by the sessions."
+msgstr ""
+"会话清理间隔,单位为秒(默认12秒)。服务端会周期性清理过期的会话,释放会话占用的资"
+"源。"
+
+#: of pywebio.platform.aiohttp.start_server:8
+#: pywebio.platform.tornado_http.start_server:10
+msgid ""
+"The rest arguments of ``start_server()`` have the same meaning as for :func:"
+"`pywebio.platform.tornado.start_server`"
+msgstr ""
+"剩余参数的详细说明见 :func:`pywebio.platform.tornado.start_server` 的同名参数。"
+
+#: of pywebio.platform.tornado_http.webio_handler:1
+msgid ""
+"Get the ``RequestHandler`` class for running PyWebIO applications in Tornado. The "
+"``RequestHandler``  communicates with the browser by HTTP protocol."
+msgstr ""
+"获取在Tornado中运行PyWebIO应用的RequestHandler类。RequestHandler类基于HTTP协议与浏"
+"览器进行通讯。"
+
+#: of pywebio.platform.tornado_http.webio_handler:4
+msgid ""
+"The arguments of ``webio_handler()`` have the same meaning as for :func:`pywebio."
+"platform.tornado_http.start_server`"
+msgstr ""
+"关于各参数的详细说明见 :func:`pywebio.platform.tornado_http.start_server` 的同名参"
+"数。"
+
+#: of pywebio.platform:52
 msgid "Flask support"
 msgstr ""
 
-#: of pywebio.platform:13
+#: of pywebio.platform:54
 msgid ""
 "When using the Flask as PyWebIO backend server, you need to install Flask by "
 "yourself and make sure the version is not less than ``0.10``. You can install it "
@@ -297,7 +478,7 @@ msgstr ""
 "``0.10`` 。\n"
 "可通过以下命令安装::"
 
-#: of pywebio.platform:16
+#: of pywebio.platform:57
 msgid "pip3 install -U flask>=0.10"
 msgstr ""
 
@@ -307,30 +488,7 @@ msgid ""
 "communicates with the browser by HTTP protocol."
 msgstr "获取在Flask中运行PyWebIO任务的视图函数。基于http请求与前端页面进行通讯"
 
-#: of pywebio.platform.aiohttp.webio_handler:4 pywebio.platform.django.webio_view:4
-#: pywebio.platform.flask.webio_view:4
-msgid "PyWebIO application."
-msgstr "PyWebIO应用"
-
-#: of pywebio.platform.django.webio_view:7 pywebio.platform.flask.webio_view:7
-msgid "Session expiration time, in seconds(default 60s)."
-msgstr "会话过期时间,单位为秒(默认60秒)。"
-
-#: of pywebio.platform.django.webio_view:8 pywebio.platform.flask.webio_view:8
-msgid "Session cleanup interval, in seconds(default 120s)."
-msgstr "会话清理间隔,单位为秒(默认120秒)。"
-
-#: of pywebio.platform.aiohttp.webio_handler:7 pywebio.platform.django.webio_view:9
-#: pywebio.platform.flask.webio_view:9
-msgid "Allowed request source list."
-msgstr "除当前域名外,服务器还允许的请求的来源列表。"
-
-#: of pywebio.platform.aiohttp.webio_handler:8 pywebio.platform.django.webio_view:10
-#: pywebio.platform.flask.webio_view:10
-msgid "The validation function for request source."
-msgstr "请求来源检查函数"
-
-#: of pywebio.platform.flask.webio_view:12
+#: of pywebio.platform.flask.webio_view:4
 msgid ""
 "The arguments of ``webio_view()`` have the same meaning as for :func:`pywebio."
 "platform.flask.start_server`"
@@ -341,56 +499,29 @@ msgstr ""
 msgid "Start a Flask server to provide the PyWebIO application as a web service."
 msgstr "启动一个 Flask server 将PyWebIO应用作为Web服务提供。"
 
-#: of pywebio.platform.aiohttp.start_server:3 pywebio.platform.django.start_server:3
-#: pywebio.platform.flask.start_server:3
+#: of pywebio.platform.flask.start_server:3
 msgid ""
-"PyWebIO application. The argument has the same meaning and format as for :func:"
-"`pywebio.platform.tornado.start_server`"
+"Session expiration time, in seconds(default 600s). If no client message is "
+"received within ``session_expire_seconds``, the session will be considered expired."
 msgstr ""
-"PyWebIO应用. 格式同 :func:`pywebio.platform.tornado.start_server` 的 "
-"``applications`` 参数"
-
-#: of pywebio.platform.aiohttp.start_server:15
-#: pywebio.platform.django.start_server:14 pywebio.platform.flask.start_server:14
-msgid ""
-"Allowed request source list. The argument has the same meaning as for :func:"
-"`pywebio.platform.tornado.start_server`"
-msgstr ""
-"除当前域名外,服务器还允许的请求的来源列表。格式同 :func:`pywebio.platform.tornado."
-"start_server` 的 ``allowed_origins`` 参数"
-
-#: of pywebio.platform.aiohttp.start_server:17
-#: pywebio.platform.django.start_server:16 pywebio.platform.flask.start_server:16
-msgid ""
-"The validation function for request source. The argument has the same meaning and "
-"format as for :func:`pywebio.platform.tornado.start_server`"
-msgstr ""
-"请求来源检查函数。格式同 :func:`pywebio.platform.tornado.start_server` 的 "
-"``check_origin`` 参数"
-
-#: of pywebio.platform.django.start_server:18 pywebio.platform.flask.start_server:18
-msgid ""
-"Session expiration time, in seconds(default 60s). If no client message is received "
-"within ``session_expire_seconds``, the session will be considered expired."
-msgstr ""
-"会话过期时间,单位为秒(默认60秒)。若 session_expire_seconds 秒内没有收到客户端的"
+"会话过期时间,单位为秒(默认600秒)。若 session_expire_seconds 秒内没有收到客户端的"
 "请求,则认为会话过期。"
 
-#: of pywebio.platform.django.start_server:20 pywebio.platform.flask.start_server:20
+#: of pywebio.platform.flask.start_server:5
 msgid ""
-"Session cleanup interval, in seconds(default 120s). The server will periodically "
+"Session cleanup interval, in seconds(default 300s). The server will periodically "
 "clean up expired sessions and release the resources occupied by the sessions."
 msgstr ""
-"会话清理间隔,单位为秒(默认12秒)。服务端会周期性清理过期的会话,释放会话占用的资"
+"会话清理间隔,单位为秒(默认300秒)。服务端会周期性清理过期的会话,释放会话占用的资"
 "源。"
 
-#: of pywebio.platform.flask.start_server:22
+#: of pywebio.platform.flask.start_server:7
 msgid ""
 "Flask debug mode. If enabled, the server will automatically reload for code "
 "changes."
 msgstr "是否开启Flask Server的debug模式,开启后,代码发生修改后服务器会自动重启。"
 
-#: of pywebio.platform.flask.start_server:24
+#: of pywebio.platform.flask.start_server:9
 msgid ""
 "Additional keyword arguments passed to the ``flask.Flask.run``. For details, "
 "please refer: https://flask.palletsprojects.com/en/1.1.x/api/#flask.Flask.run"
@@ -398,11 +529,18 @@ msgstr ""
 "传递给 ``flask.Flask.run`` 函数的额外的关键字参数\n"
 "可设置项参考: https://flask.palletsprojects.com/en/1.1.x/api/#flask.Flask.run"
 
-#: of pywebio.platform:23
+#: of pywebio.platform.flask.start_server:12
+msgid ""
+"The arguments of ``start_server()`` have the same meaning as for :func:`pywebio."
+"platform.tornado.start_server`"
+msgstr ""
+"关于各参数的详细说明见 :func:`pywebio.platform.tornado.start_server` 的同名参数"
+
+#: of pywebio.platform:64
 msgid "Django support"
 msgstr ""
 
-#: of pywebio.platform:25
+#: of pywebio.platform:66
 msgid ""
 "When using the Django as PyWebIO backend server, you need to install Django by "
 "yourself and make sure the version is not less than ``2.2``. You can install it "
@@ -412,7 +550,7 @@ msgstr ""
 "``2.2`` 。\n"
 "可通过以下命令安装::"
 
-#: of pywebio.platform:28
+#: of pywebio.platform:69
 msgid "pip3 install -U django>=2.2"
 msgstr ""
 
@@ -422,18 +560,18 @@ msgid ""
 "communicates with the browser by HTTP protocol."
 msgstr "获取在django中运行PyWebIO任务的视图函数。 基于http请求与前端进行通讯"
 
-#: of pywebio.platform.django.webio_view:12
+#: of pywebio.platform.django.webio_view:4
 msgid ""
 "The arguments of ``webio_view()`` have the same meaning as for :func:`pywebio."
-"platform.django.start_server`"
+"platform.flask.webio_view`"
 msgstr ""
-"关于各参数的详细说明见 :func:`pywebio.platform.django.start_server` 的同名参数。"
+"关于各参数的详细说明见 :func:`pywebio.platform.flask.webio_view` 的同名参数。"
 
 #: of pywebio.platform.django.start_server:1
 msgid "Start a Django server to provide the PyWebIO application as a web service."
 msgstr "启动一个 Django server 将PyWebIO应用作为Web服务提供。"
 
-#: of pywebio.platform.django.start_server:22
+#: of pywebio.platform.django.start_server:3
 msgid ""
 "Django debug mode. See `Django doc <https://docs.djangoproject.com/en/3.0/ref/"
 "settings/#debug>`_ for more detail."
@@ -441,7 +579,7 @@ msgstr ""
 "开启 Django debug mode。参见 `Django doc <https://docs.djangoproject.com/en/3.0/"
 "ref/settings/#debug>`_ ."
 
-#: of pywebio.platform.django.start_server:24
+#: of pywebio.platform.django.start_server:5
 msgid ""
 "Additional settings to django server. For details, please refer: https://docs."
 "djangoproject.com/en/3.0/ref/settings/ . Among them, ``DEBUG``, ``ALLOWED_HOSTS``, "
@@ -452,11 +590,18 @@ msgstr ""
 "其中 ``DEBUG`` 、 ``ALLOWED_HOSTS`` 、 ``ROOT_URLCONF`` 、 ``SECRET_KEY`` 被PyWebIO"
 "设置,无法在 ``django_options`` 中指定"
 
-#: of pywebio.platform:34
+#: of pywebio.platform.django.start_server:9
+msgid ""
+"The rest arguments of ``start_server()`` have the same meaning as for :func:"
+"`pywebio.platform.flask.start_server`"
+msgstr ""
+"剩余参数的详细说明见 :func:`pywebio.platform.flask.start_server` 的同名参数。"
+
+#: of pywebio.platform:75
 msgid "aiohttp support"
 msgstr ""
 
-#: of pywebio.platform:36
+#: of pywebio.platform:77
 msgid ""
 "When using the aiohttp as PyWebIO backend server, you need to install aiohttp by "
 "yourself and make sure the version is not less than ``3.1``. You can install it "
@@ -466,7 +611,7 @@ msgstr ""
 "``3.1`` 。\n"
 "可通过以下命令安装::"
 
-#: of pywebio.platform:39
+#: of pywebio.platform:80
 msgid "pip3 install -U aiohttp>=3.1"
 msgstr ""
 
@@ -480,14 +625,7 @@ msgstr ""
 "stable/web_quickstart.html#aiohttp-web-handler>`_ 协程。Request Handler基于"
 "WebSocket协议与浏览器进行通讯。"
 
-#: of pywebio.platform.aiohttp.webio_handler:9
-msgid ""
-"The  parameters passed to the constructor of ``aiohttp.web.WebSocketResponse``."
-msgstr ""
-"创建 aiohttp WebSocketResponse 时使用的参数。见 https://docs.aiohttp.org/en/stable/"
-"web_reference.html#websocketresponse"
-
-#: of pywebio.platform.aiohttp.webio_handler:11
+#: of pywebio.platform.aiohttp.webio_handler:4
 msgid ""
 "The arguments of ``webio_handler()`` have the same meaning as for :func:`pywebio."
 "platform.aiohttp.start_server`"
@@ -499,7 +637,7 @@ msgstr ""
 msgid "Returns"
 msgstr ""
 
-#: of pywebio.platform.aiohttp.webio_handler:13
+#: of pywebio.platform.aiohttp.webio_handler:6
 msgid "aiohttp Request Handler"
 msgstr ""
 
@@ -507,11 +645,7 @@ msgstr ""
 msgid "Start a aiohttp server to provide the PyWebIO application as a web service."
 msgstr "启动一个 aiohttp server 将PyWebIO应用作为Web服务提供。"
 
-#: of pywebio.platform.aiohttp.start_server:8
-msgid "aiohttp debug mode."
-msgstr "是否开启asyncio的Debug模式"
-
-#: of pywebio.platform.aiohttp.start_server:20
+#: of pywebio.platform.aiohttp.start_server:3
 msgid ""
 "The  parameters passed to the constructor of ``aiohttp.web.WebSocketResponse``. "
 "For details, please refer: https://docs.aiohttp.org/en/stable/web_reference."
@@ -520,7 +654,7 @@ msgstr ""
 "创建 aiohttp WebSocketResponse 时使用的参数。见 https://docs.aiohttp.org/en/stable/"
 "web_reference.html#websocketresponse"
 
-#: of pywebio.platform.aiohttp.start_server:22
+#: of pywebio.platform.aiohttp.start_server:5
 msgid ""
 "Additional keyword arguments passed to the constructor of ``aiohttp.web."
 "Application``. For details, please refer: https://docs.aiohttp.org/en/stable/"
@@ -529,7 +663,7 @@ msgstr ""
 "需要传给 aiohttp Application 的参数。可用参数见 https://docs.aiohttp.org/en/stable/"
 "web_reference.html#application"
 
-#: of pywebio.platform:45
+#: of pywebio.platform:86
 msgid "Other"
 msgstr "其他"
 
@@ -609,7 +743,7 @@ msgstr "运行 asyncio 事件循环"
 
 #: of pywebio.platform.run_event_loop:3
 msgid ""
-"See also: :ref:`Integration coroutine-based session with Web framework "
+"..seealso:: :ref:`Integration coroutine-based session with Web framework "
 "<coroutine_web_integration>`"
 msgstr ""
 
@@ -621,3 +755,54 @@ msgstr ""
 
 #~ msgid "Session cleanup interval, in seconds(default 20s)."
 #~ msgstr "会话清理间隔(秒)。"
+
+#~ msgid "PyWebIO application."
+#~ msgstr "PyWebIO应用"
+
+#~ msgid "Session expiration time, in seconds(default 60s)."
+#~ msgstr "会话过期时间,单位为秒(默认60秒)。"
+
+#~ msgid "Session cleanup interval, in seconds(default 120s)."
+#~ msgstr "会话清理间隔,单位为秒(默认120秒)。"
+
+#~ msgid "Allowed request source list."
+#~ msgstr "除当前域名外,服务器还允许的请求的来源列表。"
+
+#~ msgid "The validation function for request source."
+#~ msgstr "请求来源检查函数"
+
+#~ msgid ""
+#~ "PyWebIO application. The argument has the same meaning and format as for :func:"
+#~ "`pywebio.platform.tornado.start_server`"
+#~ msgstr ""
+#~ "PyWebIO应用. 格式同 :func:`pywebio.platform.tornado.start_server` 的 "
+#~ "``applications`` 参数"
+
+#~ msgid ""
+#~ "Allowed request source list. The argument has the same meaning as for :func:"
+#~ "`pywebio.platform.tornado.start_server`"
+#~ msgstr ""
+#~ "除当前域名外,服务器还允许的请求的来源列表。格式同 :func:`pywebio.platform."
+#~ "tornado.start_server` 的 ``allowed_origins`` 参数"
+
+#~ msgid ""
+#~ "The validation function for request source. The argument has the same meaning "
+#~ "and format as for :func:`pywebio.platform.tornado.start_server`"
+#~ msgstr ""
+#~ "请求来源检查函数。格式同 :func:`pywebio.platform.tornado.start_server` 的 "
+#~ "``check_origin`` 参数"
+
+#~ msgid ""
+#~ "The arguments of ``webio_view()`` have the same meaning as for :func:`pywebio."
+#~ "platform.django.start_server`"
+#~ msgstr ""
+#~ "关于各参数的详细说明见 :func:`pywebio.platform.django.start_server` 的同名参数。"
+
+#~ msgid ""
+#~ "The  parameters passed to the constructor of ``aiohttp.web.WebSocketResponse``."
+#~ msgstr ""
+#~ "创建 aiohttp WebSocketResponse 时使用的参数。见 https://docs.aiohttp.org/en/"
+#~ "stable/web_reference.html#websocketresponse"
+
+#~ msgid "aiohttp debug mode."
+#~ msgstr "是否开启asyncio的Debug模式"

+ 11 - 6
pywebio/platform/__init__.py

@@ -1,10 +1,16 @@
 r"""
 The ``platform`` module provides support for deploying PyWebIO applications in different web frameworks.
 
+.. seealso::
+
+   * :ref:`Integration with Web Framework <integration_web_framework>`
+
+   * :ref:`Server mode and Script mode <server_and_script_mode>`
+
 Directory Deploy
 -----------------
 
-You can use ``path_deploy`` or ``path_deploy_http`` to deploy the PyWebIO applications from a directory.
+You can use ``path_deploy()`` or ``path_deploy_http()`` to deploy the PyWebIO applications from a directory.
 You can access the application by using the file path as the URL.
 
 .. autofunction:: pywebio.platform.path_deploy
@@ -13,18 +19,17 @@ You can access the application by using the file path as the URL.
 Application Deploy
 --------------------
 
-The ``start_server`` functions can start a Python Web server and serve given PyWebIO applications on it.
+The ``start_server()`` functions can start a Python Web server and serve given PyWebIO applications on it.
 
-The ``webio_handler`` and ``webio_view`` functions can be used to integrate yWebIO applications into existing Python Web project.
-See also: :ref:`Integration with Web Framework <integration_web_framework>` section of user manual.
+The ``webio_handler()`` and ``webio_view()`` functions can be used to integrate PyWebIO applications into existing Python Web project.
 
 .. versionchanged:: 1.1
 
-   Added the ``cdn`` parameter in ``start_server``, ``webio_handler`` and ``webio_view``.
+   Added the ``cdn`` parameter in ``start_server()``, ``webio_handler()`` and ``webio_view()``.
 
 .. versionchanged:: 1.2
 
-   Added the ``static_dir`` parameter in ``start_server``.
+   Added the ``static_dir`` parameter in ``start_server()``.
 
 Tornado support
 ^^^^^^^^^^^^^^^^^^^^

+ 2 - 24
pywebio/platform/aiohttp.py

@@ -115,13 +115,6 @@ def webio_handler(applications, cdn=True, allowed_origins=None, check_origin=Non
     """Get the `Request Handler <https://docs.aiohttp.org/en/stable/web_quickstart.html#aiohttp-web-handler>`_ coroutine for running PyWebIO applications in aiohttp.
     The handler communicates with the browser by WebSocket protocol.
 
-    :param list/dict/callable applications: PyWebIO application.
-    :param bool/str cdn: Whether to load front-end static resources from CDN, the default is ``True``.
-       Can also use a string to directly set the url of PyWebIO static resources.
-    :param list allowed_origins: Allowed request source list.
-    :param callable check_origin: The validation function for request source.
-    :param dict websocket_settings: The  parameters passed to the constructor of ``aiohttp.web.WebSocketResponse``.
-
     The arguments of ``webio_handler()`` have the same meaning as for :func:`pywebio.platform.aiohttp.start_server`
 
     :return: aiohttp Request Handler
@@ -170,27 +163,12 @@ def start_server(applications, port=0, host='', debug=False,
                  **aiohttp_settings):
     """Start a aiohttp server to provide the PyWebIO application as a web service.
 
-    :param list/dict/callable applications: PyWebIO application.
-       The argument has the same meaning and format as for :func:`pywebio.platform.tornado.start_server`
-    :param int port: The port the server listens on.
-       When set to ``0``, the server will automatically select a available port.
-    :param str host: The host the server listens on. ``host`` may be either an IP address or hostname. If it’s a hostname, the server will listen on all IP addresses associated with the name. ``host`` may be an empty string or None to listen on all available interfaces.
-    :param bool debug: aiohttp debug mode.
-    :param bool/str cdn: Whether to load front-end static resources from CDN, the default is ``True``.
-       Can also use a string to directly set the url of PyWebIO static resources.
-    :param str static_dir: The directory to store the application static files.
-       The files in this directory can be accessed via ``http://<host>:<port>/static/files``.
-       For example, if there is a ``A/B.jpg`` file in ``http_static_dir`` path,
-       it can be accessed via ``http://<host>:<port>/static/A/B.jpg``.
-    :param list allowed_origins: Allowed request source list.
-       The argument has the same meaning as for :func:`pywebio.platform.tornado.start_server`
-    :param callable check_origin: The validation function for request source.
-       The argument has the same meaning and format as for :func:`pywebio.platform.tornado.start_server`
-    :param bool auto_open_webbrowser: Whether or not auto open web browser when server is started (if the operating system allows it) .
     :param dict websocket_settings: The  parameters passed to the constructor of ``aiohttp.web.WebSocketResponse``.
        For details, please refer: https://docs.aiohttp.org/en/stable/web_reference.html#websocketresponse
     :param aiohttp_settings: Additional keyword arguments passed to the constructor of ``aiohttp.web.Application``.
        For details, please refer: https://docs.aiohttp.org/en/stable/web_reference.html#application
+
+    The rest arguments of ``start_server()`` have the same meaning as for :func:`pywebio.platform.tornado.start_server`
     """
     kwargs = locals()
 

+ 3 - 28
pywebio/platform/django.py

@@ -79,15 +79,7 @@ def webio_view(applications, cdn=True,
     """Get the view function for running PyWebIO applications in Django.
     The view communicates with the browser by HTTP protocol.
 
-    :param list/dict/callable applications: PyWebIO application.
-    :param bool/str cdn: Whether to load front-end static resources from CDN, the default is ``True``.
-       Can also use a string to directly set the url of PyWebIO static resources.
-    :param int session_expire_seconds: Session expiration time, in seconds(default 600s).
-    :param int session_cleanup_interval: Session cleanup interval, in seconds(default 300s).
-    :param list allowed_origins: Allowed request source list.
-    :param callable check_origin: The validation function for request source.
-
-    The arguments of ``webio_view()`` have the same meaning as for :func:`pywebio.platform.django.start_server`
+    The arguments of ``webio_view()`` have the same meaning as for :func:`pywebio.platform.flask.webio_view`
     """
     cdn = cdn_validation(cdn, 'error')
     handler = HttpHandler(applications=applications, cdn=cdn,
@@ -116,30 +108,13 @@ def start_server(applications, port=8080, host='localhost', cdn=True, static_dir
                  debug=False, **django_options):
     """Start a Django server to provide the PyWebIO application as a web service.
 
-    :param list/dict/callable applications: PyWebIO application.
-       The argument has the same meaning and format as for :func:`pywebio.platform.tornado.start_server`
-    :param int port: The port the server listens on.
-       When set to ``0``, the server will automatically select a available port.
-    :param str host: The host the server listens on. ``host`` may be either an IP address or hostname. If it’s a hostname, the server will listen on all IP addresses associated with the name. ``host`` may be an empty string or None to listen on all available interfaces.
-    :param bool/str cdn: Whether to load front-end static resources from CDN, the default is ``True``.
-       Can also use a string to directly set the url of PyWebIO static resources.
-    :param str static_dir: The directory to store the application static files.
-       The files in this directory can be accessed via ``http://<host>:<port>/static/files``.
-       For example, if there is a ``A/B.jpg`` file in ``http_static_dir`` path,
-       it can be accessed via ``http://<host>:<port>/static/A/B.jpg``.
-    :param list allowed_origins: Allowed request source list.
-       The argument has the same meaning as for :func:`pywebio.platform.tornado.start_server`
-    :param callable check_origin: The validation function for request source.
-       The argument has the same meaning and format as for :func:`pywebio.platform.tornado.start_server`
-    :param int session_expire_seconds: Session expiration time, in seconds(default 600s).
-       If no client message is received within ``session_expire_seconds``, the session will be considered expired.
-    :param int session_cleanup_interval: Session cleanup interval, in seconds(default 300s).
-       The server will periodically clean up expired sessions and release the resources occupied by the sessions.
     :param bool debug: Django debug mode.
        See `Django doc <https://docs.djangoproject.com/en/3.0/ref/settings/#debug>`_ for more detail.
     :param django_options: Additional settings to django server.
        For details, please refer: https://docs.djangoproject.com/en/3.0/ref/settings/ .
        Among them, ``DEBUG``, ``ALLOWED_HOSTS``, ``ROOT_URLCONF``, ``SECRET_KEY`` are set by PyWebIO and cannot be specified in ``django_options``.
+
+    The rest arguments of ``start_server()`` have the same meaning as for :func:`pywebio.platform.flask.start_server`
     """
     global urlpatterns
 

+ 2 - 23
pywebio/platform/flask.py

@@ -82,14 +82,6 @@ def webio_view(applications, cdn=True,
     """Get the view function for running PyWebIO applications in Flask.
     The view communicates with the browser by HTTP protocol.
 
-    :param list/dict/callable applications: PyWebIO application.
-    :param bool/str cdn: Whether to load front-end static resources from CDN, the default is ``True``.
-       Can also use a string to directly set the url of PyWebIO static resources.
-    :param int session_expire_seconds: Session expiration time, in seconds(default 600s).
-    :param int session_cleanup_interval: Session cleanup interval, in seconds(default 300s).
-    :param list allowed_origins: Allowed request source list.
-    :param callable check_origin: The validation function for request source.
-
     The arguments of ``webio_view()`` have the same meaning as for :func:`pywebio.platform.flask.start_server`
     """
 
@@ -115,21 +107,6 @@ def start_server(applications, port=8080, host='localhost', cdn=True, static_dir
                  debug=False, **flask_options):
     """Start a Flask server to provide the PyWebIO application as a web service.
 
-    :param list/dict/callable applications: PyWebIO application.
-       The argument has the same meaning and format as for :func:`pywebio.platform.tornado.start_server`
-    :param int port: The port the server listens on.
-       When set to ``0``, the server will automatically select a available port.
-    :param str host: The host the server listens on. ``host`` may be either an IP address or hostname. If it’s a hostname, the server will listen on all IP addresses associated with the name. ``host`` may be an empty string or None to listen on all available interfaces.
-    :param bool/str cdn: Whether to load front-end static resources from CDN, the default is ``True``.
-       Can also use a string to directly set the url of PyWebIO static resources.
-    :param str static_dir: The directory to store the application static files.
-       The files in this directory can be accessed via ``http://<host>:<port>/static/files``.
-       For example, if there is a ``A/B.jpg`` file in ``http_static_dir`` path,
-       it can be accessed via ``http://<host>:<port>/static/A/B.jpg``.
-    :param list allowed_origins: Allowed request source list.
-       The argument has the same meaning as for :func:`pywebio.platform.tornado.start_server`
-    :param callable check_origin: The validation function for request source.
-       The argument has the same meaning and format as for :func:`pywebio.platform.tornado.start_server`
     :param int session_expire_seconds: Session expiration time, in seconds(default 600s).
        If no client message is received within ``session_expire_seconds``, the session will be considered expired.
     :param int session_cleanup_interval: Session cleanup interval, in seconds(default 300s).
@@ -138,6 +115,8 @@ def start_server(applications, port=8080, host='localhost', cdn=True, static_dir
        If enabled, the server will automatically reload for code changes.
     :param flask_options: Additional keyword arguments passed to the ``flask.Flask.run``.
        For details, please refer: https://flask.palletsprojects.com/en/1.1.x/api/#flask.Flask.run
+
+    The arguments of ``start_server()`` have the same meaning as for :func:`pywebio.platform.tornado.start_server`
     """
     if not host:
         host = '0.0.0.0'

+ 1 - 1
pywebio/platform/httpbased.py

@@ -281,7 +281,7 @@ class HttpHandler:
 def run_event_loop(debug=False):
     """run asyncio event loop
 
-    See also: :ref:`Integration coroutine-based session with Web framework <coroutine_web_integration>`
+    ..seealso:: :ref:`Integration coroutine-based session with Web framework <coroutine_web_integration>`
 
     :param debug: Set the debug mode of the event loop.
        See also: https://docs.python.org/3/library/asyncio-dev.html#asyncio-debug-mode

+ 2 - 2
pywebio/platform/path_deploy.py

@@ -181,11 +181,11 @@ def path_deploy(base, port=0, host='',
 
     :param str base: Base directory to load PyWebIO application.
     :param int port: The port the server listens on.
-    :param str host: he host the server listens on.
+    :param str host: The host the server listens on.
     :param bool/callable index: Whether to provide a default index page when request a directory, default is ``True``.
        ``index`` also accepts a function to custom index page, which receives the requested directory path as parameter and return HTML content in string.
 
-       You can override the index page by add a 'index.py' PyWebIO app file to the directory.
+       You can override the index page by add a `index.py` PyWebIO app file to the directory.
     :param str static_dir: Directory to store the application static files.
        The files in this directory can be accessed via ``http://<host>:<port>/static/files``.
        For example, if there is a ``A/B.jpg`` file in ``http_static_dir`` path,