Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

静态资源托管不是所有资源都生效 #630

Open
xiaohuanshu opened this issue Dec 25, 2023 · 5 comments
Open

静态资源托管不是所有资源都生效 #630

xiaohuanshu opened this issue Dec 25, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@xiaohuanshu
Copy link

xiaohuanshu commented Dec 25, 2023

BUG描述
根据https://pywebio.readthedocs.io/zh-cn/latest/advanced.html#notes 的描述进行自托管静态文件后,plotly和ag-grid依然使用cdn文件。看了下代码是因为使用了requireJs,这几个库没有放入仓库中有什么license上的原因吗?

@xiaohuanshu xiaohuanshu added the bug Something isn't working label Dec 25, 2023
@wang0618
Copy link
Member

wang0618 commented Dec 27, 2023

你可以通过 pywebio.session.run_js() 来手动设置这两个库的请求地址,设置的语法参见

require.config({
paths: {
'plotly': "https://cdn.plot.ly/plotly-2.12.1.min",
"ag-grid": "https://unpkg.com/[email protected]/dist/ag-grid-community.min",
"ag-grid-enterprise": "https://unpkg.com/[email protected]/dist/ag-grid-enterprise.min",
},
});

@xiaohuanshu
Copy link
Author

多谢,我已经手动指定了,不过不知道为啥不能放到仓库里呢?

@demaxiya
Copy link

多谢,我已经手动指定了,不过不知道为啥不能放到仓库里呢?

请问如何指定的,我能看看你怎么写的吗?

@xiaohuanshu
Copy link
Author

xiaohuanshu commented Jan 17, 2024

多谢,我已经手动指定了,不过不知道为啥不能放到仓库里呢?

请问如何指定的,我能看看你怎么写的吗?

放到config.js_code里

require.config({
            paths: {
                "ag-grid": "/static/own/ag-grid-community.min",
                "ag-grid-enterprise": "/static/own/ag-grid-enterprise.min",
            },
       });

@demaxiya
Copy link

多谢,我已经手动指定了,不过不知道为啥不能放到仓库里呢?

请问如何指定的,我能看看你怎么写的吗?

放到config.js_code里

require.config({
            paths: {
                "ag-grid": "/static/own/ag-grid-community.min",
                "ag-grid-enterprise": "/static/own/ag-grid-enterprise.min",
            },
       });

谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants