我在 django 为我的 vuejs SPA 服务/app/
提供静态文件/static/
我的应用程序在 django 开发中运行良好,但是 collectstatic 失败。
我的 vue.config.js 有:
module.exports = {
assetsDir: 'static',
}
编译后的 CSS 文件具有如下字体 url:
url(../../static/fonts/materialdesignicons-webfont.ee2bb9f3.eot
这在浏览器中有效,因为它不能上升 2 个目录,但在文件系统中上升 2 个目录而不是一个。
在浏览器中工作正常,但无法部署。它抛出SuspiciousFileOperation
异常:
django.core.exceptions.SuspiciousFileOperation: The joined path (/mnt/c/Users/static/fonts/materialdesignicons-webfont.ee2bb9f3.eot) is located outside of the base path component (/mnt/c/Users/fede_/braced/staticfiles)
我真的坚持这一点。