PyWebIO v1.1.0 使用手册
start_server(bmi, port=80) 便可以在80端口提供 bmi() 服务( 在线Demo [http://pywebio- demos.demo.wangweimin.site/?pywebio_api=bmi] )。 将 bmi() 服务整合到现有的Web框架请参考 与Web框架集成 Documentation 这个文档同时也提供 PDF 和 Epub 格式 [https://readthedocs 如果你接触过Web开发,你可能对接下来描述的PyWebIO的用法感到不太习 惯,不同于传统Web开发的后端实现接口、前端进行展示交互的模式,在 PyWebIO中,所有的逻辑都通过编写Python代码实现。 你可以按照编写控制台程序的逻辑编写PyWebIO应用,只不过这里的终端变成 了浏览器。通过PyWebIO提供的命令式API, 你可以简单地调用 put_text 、 put_image 、 put_table =False) 来关闭动画。 有关不同环境配置的效果可查看 set_env Demo [http://pywebio- demos.demo.wangweimin.site/?pywebio_api=set_env_demo] 布局 一般情况下,使用上文介绍的各种输出函数足以完成各种内容的展示,但直接 调用输出函数产生的输出之间都是竖直排列的,如果想实现更复杂的布局(比 如在页面左侧显示一0 码力 | 119 页 | 7.41 MB | 1 年前3PyWebIO v1.2.3 使用手册
start_server(bmi, port=80) 便可以在80端口提供 bmi() 服务( 在线Demo [http://pywebio- demos.demo.wangweimin.site/?pywebio_api=bmi] )。 将 bmi() 服务整合到现有的Web框架请参考 与Web框架集成 。 Documentation 这个文档同时也提供 PDF 和 Epub 格式 [https://readthedocs 如果你接触过Web开发,你可能对接下来描述的PyWebIO的用法感到不太习 惯,不同于传统Web开发的后端实现接口、前端进行展示交互的模式,在 PyWebIO中,所有的逻辑都通过编写Python代码实现。 你可以按照编写控制台程序的逻辑编写PyWebIO应用,只不过这里的终端变成 了浏览器。通过PyWebIO提供的命令式API, 你可以简单地调用 put_text 、 put_image 、 put_table =False) 来关闭动画。 有关不同环境配置的效果可查看 set_env Demo [http://pywebio- demos.demo.wangweimin.site/?pywebio_api=set_env_demo] 布局 In general, using the output functions introduced above is enough to output what0 码力 | 119 页 | 7.44 MB | 1 年前3PyWebIO v1.2.2 使用手册
start_server(bmi, port=80) 便可以在80端口提供 bmi() 服务( 在线Demo [http://pywebio- demos.demo.wangweimin.site/?pywebio_api=bmi] )。 将 bmi() 服务整合到现有的Web框架请参考 与Web框架集成 。 Documentation 这个文档同时也提供 PDF 和 Epub 格式 [https://readthedocs 如果你接触过Web开发,你可能对接下来描述的PyWebIO的用法感到不太习 惯,不同于传统Web开发的后端实现接口、前端进行展示交互的模式,在 PyWebIO中,所有的逻辑都通过编写Python代码实现。 你可以按照编写控制台程序的逻辑编写PyWebIO应用,只不过这里的终端变成 了浏览器。通过PyWebIO提供的命令式API, 你可以简单地调用 put_text 、 put_image 、 put_table =False) 来关闭动画。 有关不同环境配置的效果可查看 set_env Demo [http://pywebio- demos.demo.wangweimin.site/?pywebio_api=set_env_demo] 布局 with use_scope('scope1'): put_text('A') put_text('B', position=0) # insert0 码力 | 119 页 | 7.41 MB | 1 年前3PyWebIO v1.0.3 使用手册
start_server(bmi, port=80) 便可以在80端口提供 bmi() 服务( 在线Demo [http://pywebio- demos.demo.wangweimin.site/?pywebio_api=bmi] )。 将 bmi() 服务整合到现有的Web框架请参考 与Web框架集成 Documentation 这个文档同时也提供 PDF 和 Epub 格式 [https://readthedocs 如果你接触过Web开发,你可能对接下来描述的PyWebIO的用法感到不太习 惯,不同于传统Web开发的后端实现接口、前端进行展示交互的模式,在 PyWebIO中,所有的逻辑都通过编写Python代码实现。 你可以按照编写控制台程序的逻辑编写PyWebIO应用,只不过这里的终端变成 了浏览器。通过PyWebIO提供的命令式API, 你可以简单地调用 put_text 、 put_image 、 put_table =False) 来关闭动画。 有关不同环境配置的效果可查看 set_env Demo [http://pywebio- demos.demo.wangweimin.site/?pywebio_api=set_env_demo] 布局 一般情况下,使用上文介绍的各种输出函数足以完成各种内容的展示,但直接 调用输出函数产生的输出之间都是竖直排列的,如果想实现更复杂的布局(比 如在页面左侧显示一0 码力 | 106 页 | 7.34 MB | 1 年前3PyWebIO v0.3.0 使用手册
与Web框架集成 PyWebIO 目前支持与Flask和Tornado Web框架的集成。 与Web框架集成需要完 成两件事情:托管PyWebIO静态文件;暴露PyWebIO后端接口。 这其中需要注 意前端页面和后端接口的路径约定,以及前端静态文件与后端接口分开部署时 因为跨域而需要的特别设置。 不同Web框架的集成方法如下: Tornado Flask Django aioh�p 需要在Tornado应用中引入两个 在django的路由配置文件 urls.py 中加入PyWebIO相关的路由即可: 注意事项 PyWebIO静态资源的托管 在开发阶段,使用后端框架提供的静态文件服务对于开发和调试都十分方便, 上文的与Web框架集成的示例代码也都是使用了后端框架提供的静态文件服 务。 但出于性能考虑,托管静态文件最好的方式是使用 反向代理 [https://en.wikipedia.org/wiki/Reverse_proxy] port=8080) 前端页面和后端接口的路径约定 PyWebIO默认通过当前页面的同级的 ./io API与后端进行通讯。 例如你将PyWebIO静态文件托管到 /A/B/C/(.*) 路径下,那么你需要将 PyWebIO API的路由绑定到 /A/B/C/io 处; 你也可以在PyWebIO前端页面使用 pywebio_api Url参数来指定PyWebIO后端API地址, 例如 /A/B/C/0 码力 | 72 页 | 8.55 MB | 1 年前3PyWebIO v1.2.3 Documentation
start a bmi web service on port 80 ( online Demo [http://pywebio-demos.demo.wangweimin.site/?pywebio_api=bmi] ). If you want to integrate the bmi() service into an existing web framework, you can visit Integration described below, which is different from the traditional web development patton that backend implement api and frontend display content. In PyWebIO, you only need write code in Python. In fact, the way of like writing a console program, except that the terminal here becomes a browser. Using the imperative API provided by PyWebIO, you can simply call put_text, put_image, put_table and other functions to output0 码力 | 119 页 | 7.43 MB | 1 年前3PyWebIO v1.2.2 Documentation
start a bmi web service on port 80 ( online Demo [http://pywebio-demos.demo.wangweimin.site/?pywebio_api=bmi] ). If you want to integrate the bmi() service into an existing web framework, you can visit Integration described below, which is different from the traditional web development patton that backend implement api and frontend display content. In PyWebIO, you only need write code in Python. In fact, the way of like writing a console program, except that the terminal here becomes a browser. Using the imperative API provided by PyWebIO, you can simply call put_text, put_image, put_table and other functions to output0 码力 | 119 页 | 7.41 MB | 1 年前3PyWebIO v0.3.0 使用手册
PyWebIO 目前支持与 Flask 和 Tornado Web 框架的集成。与 Web 框架集成需要完成两件事情:托管 PyWebIO 静态文件;暴露 PyWebIO 后端接口。这其中需要注意前端页面和后端接口的路径约定,以及前端静态文件与 后端接口分开部署时因为跨域而需要的特别设置。 不同 Web 框架的集成方法如下: Tornado Flask Django aiohttp 需要在 Tornado 静态资源的托管 在开发阶段,使用后端框架提供的静态文件服务对于开发和调试都十分方便,上文的与 Web 框架集成的示例 代码也都是使用了后端框架提供的静态文件服务。但出于性能考虑,托管静态文件最好的方式是使用 反向代 理 (比如 nginx ) 或者 CDN 服务。 前端页面和后端接口的路径约定 PyWebIO 默认通过当前页面的同级的 ./io API 与后端进行通讯。 例如你将 PyWebIO 路径下,那么你需要将 PyWebIO API 的路由绑定到 /A/ B/C/io 处;你也可以在 PyWebIO 前端页面使用 pywebio_api Url 参数来指定 PyWebIO 后端 API 地址,例 如 /A/B/C/?pywebio_api=/D/pywebio 将 PyWebIO 后端 API 地址设置到了 /D/pywebio 处。 pywebio_api 参数可以使用相对地址、绝对地址甚至指定其他服务器。0 码力 | 70 页 | 1.41 MB | 1 年前3PyWebIO v1.0.3 使用手册
PyWebIO 中,所有的逻辑都通过编写 Python 代码实现。 你可以按照编写控制台程序的逻辑编写 PyWebIO 应用,只不过这里的终端变成了浏览器。通过 PyWebIO 提 供的命令式 API,你可以简单地调用 put_text 、put_image 、put_table 等函数输出文本、图片、表格 等内容到浏览器,也可以调用 input 、select 、file_upload 等函数在浏览器上显示不同表单来接收用 Flask、Tornado、Django 和 aiohttp Web 框架的集成。 与 Web 框架集成需要完成两部分配置:托管 PyWebIO 前端静态文件;暴露 PyWebIO 后端接口。这其中需 要注意前端页面和后端接口的路径约定,以及前端静态文件与后端接口分开部署时因为跨域而需要的特别设 置。 22 Chapter 4. Documentation PyWebIO, 发布 1.0.3 集成方法 不同 StaticFileHandler 托管到 /tool/(.*) 路径下。启动 Tornado 服务器后,访问 http://localhost/tool/ 即可打开 PyWebIO 应用 注意: 当使用 Tornado 后端时,PyWebIO 使用 WebSocket 协议和浏览器进行通讯,如果你的 Tornado 应用 处在反向代理 (比如 Nginx) 之后,可能需要特别配置反向代理来支持 WebSocket 协议,这里0 码力 | 94 页 | 1.71 MB | 1 年前5PyWebIO v1.6.2 Documentation
described below, which is different from the traditional web development pattern that backend implement api and frontend display content. In PyWebIO, you only need to write code in Python. In fact, the way like writing a console program, except that the terminal here becomes a browser. Using the imperative API provided by PyWebIO, you can simply call put_text(), put_image(), put_table() and other functions to When using Flask, request is instance of flask.Request [https://flask.palletsprojects.com/en/1.1.x/api/#incoming-request-data] When using Django, request is instance of django.http.HttpRequest [https://docs0 码力 | 148 页 | 7.46 MB | 1 年前3
共 86 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9