Replies: 2 comments 5 replies
-
可使用 参考: https://github.com/pywebio/PyWebIO/blob/dev/pywebio/platform/flask.py#L129 |
Beta Was this translation helpful? Give feedback.
5 replies
-
非常感谢。。是我漏了。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
我是使用flask部署的pywebio。
因为jsdelivr不能访问了。翻了一下文档,有介绍说
PyWebIO静态资源的托管
PyWebIO默认使用CDN来获取前端的静态资源,如果要将PyWebIO应用部署到离线环境中,需要自行托管静态文件, 并将 webio_view() 或 webio_handler() 的 cdn 参数设置为 False 。
cdn=False 时需要将静态资源托管在和PyWebIO应用同级的目录下。 同时,也可以通过 cdn 参数直接设置PyWebIO静态资源的URL目录。
PyWebIO的静态文件的路径保存在 pywebio.STATIC_PATH 中,可使用命令 python3 -c "import pywebio; print(pywebio.STATIC_PATH)" 将其打印出来。
我就尝试了一下,但是没有成功。所以想请问一下具体的步骤。
以下是我的操作流程
1.flask.py中
def webio_view(applications, cdn=False,
session_expire_seconds=None,
session_cleanup_interval=None,
allowed_origins=None, check_origin=None):
cdn=True改成了False
2.吧\site-packages\pywebio\html 文件夹复制到了我的项目目录下
3.cdn = cdn_validation(cdn, 'error') 这里改成
cdn=r'../html/'
cdn = cdn_validation(cdn, 'error')
然后运行。加载静态文件失败。
我吧html找了个ftp放。吧cdn=ftp下的html地址才正常。。
请问怎么设置可以加载本地的静态资源文件?
Beta Was this translation helpful? Give feedback.
All reactions