【发布时间】:2019-09-03 16:19:50
【问题描述】:
假设我在我的开发机器上对我的 css 文件做了一些更新(我的浏览器设置为忽略缓存,并不总是立即看到更新)。
在this question等地方,我看到了给链接加版本号的做法:
<link type="text/css" href={% static "/path/mystyles.css?version=2" %} rel="stylesheet">,
这很好,但是在开发机器上,我在控制台中收到错误,并且找不到文件:
GET http://127.0.0.1:8000/path/mystyles.css%3Fversion%3D2 net::ERR_ABORTED 404 (Not Found)
我读到collectstatic 可能会在开发端修复它,但有一个看起来不祥的警告:
You have requested to collect static files at the destination
location as specified in your settings:
/patttthhhhh/static
This will overwrite existing files!
Are you sure you want to do this?
当我运行collectstatic 时会发生什么?它将从哪里获取文件以覆盖这些文件?
【问题讨论】:
标签: css django static-files