小编got*_*nix的帖子

在Flask中使用子域名时,如何访问css url中引用的静态文件和使用require.js的js文件?

烧瓶静态设置:

app = Flask(__name__.split('.')[0], static_folder=None)
app.static_url_path = '/static'
app.static_folder = 'static'
app.add_url_rule(app.static_url_path + '/<path:filename>',
                 endpoint='static',
                 view_func=app.send_static_file)
Run Code Online (Sandbox Code Playgroud)

CSS

@font-face {
    font-family: MuiiconSpread;
    font-weight: normal;
    font-style: normal;
    src:  url('../fonts/icons.ttf') format('truetype');
}
Run Code Online (Sandbox Code Playgroud)

JS

require.config({
    paths: {
        'jquery': '/static/plugins/jquery-3.3.1/jquery.min',
    },
});
Run Code Online (Sandbox Code Playgroud)

当访问子域名如: 时a.test.comicons.ttfjquery.min.js都是404错误。

当我添加subdomain='a'静态add_url_rule时,一切都会好起来的。但它只是匹配a.test.com,而访问b.test.com应该将相同的配置更改为subdomain='b'.

如何修复它?

css subdomain flask requirejs

5
推荐指数
1
解决办法
559
查看次数

为什么我的 IE11 F12 开发者工具无法“固定”?

当我使用 IE10 时,一切都很好。但是 IE11、固定按钮和“Ctrl+P”不起作用。我的系统是 Windows 7 Ultimate 64 位 SP1。

internet-explorer ie-developer-tools

4
推荐指数
1
解决办法
1048
查看次数