ManifestStaticFilesStorage-即使staticfiles.json显示正确的映射,仍会获取旧的静态文件 [英] ManifestStaticFilesStorage - still fetching old static file even when staticfiles.json shows the right mapping

查看:77
本文介绍了ManifestStaticFilesStorage-即使staticfiles.json显示正确的映射,仍会获取旧的静态文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ManifestStaticFilesStorage.在执行 collectstatic 并将文件移到prod之后,我仍然看到旧的CSS文件(带有旧的MD5哈希字符串)正在获取.

I am using using ManifestStaticFilesStorage. After performing collectstatic and moving over the files to prod, I still see old css file (with old MD5 hash string) being fetched.

settings.py:

settings.py:

STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'

在产品上,我可以看到staticfiles.json显示了正确的(新)css文件,但是当我从网页上执行查看源代码"时,仍然可以看到旧的CSS正在被获取.

On prod, I can see staticfiles.json showing the correct (new) css file but still when I do 'view-source' from the web page, I can see old css being fetched.

我可能错过了什么?

推荐答案

在移动文件后,在产品上重新启动Django.

Restart Django on prod after moving the files over.

(我不知道为什么要这样做,但这是唯一可行的方法)

(I don't know why that's required but thats the only thing that works)

这篇关于ManifestStaticFilesStorage-即使staticfiles.json显示正确的映射,仍会获取旧的静态文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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