Django CSS未更新 [英] Django CSS not updating

查看:49
本文介绍了Django CSS未更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的Django项目,我有以下代码引用我的 base.html 中的CSS脚本:

I have this code to refer to my CSS script in my base.html for my Django project:

<link href="{% static 'css/project.css' %}" rel="stylesheet">

问题在于,每当我从 project.css 中添加或删除样式时,运行服务器时该样式都不会更新.

The problem is that whenever I add or remove styling from project.css, it doesn’t update when I run the server.

我知道会发生这种情况,因为每次页面加载时,浏览器缓存都会认为它之前已经看到过该文件,然后从磁盘重新加载缓存的版本.我也知道一个解决方案是每次进行更新时都要更改CSS文件名.

I know this happens because every time the page loads the browser cache will think it’s seen the file before and reload the cached version from disk. I also know a solution is to change the CSS filename every time I make an update.

每次刷新浏览器时,是否有更简便的方法来重新加载CSS文件?

Is there an easier way to reload the CSS file every time I refresh my browser?

推荐答案

您可以使用 ctrl + F5

以获取详细参考: https://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache

这篇关于Django CSS未更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆