我想对我的一些javascript和css文件进行版本控制,因为我在网站上工作时遇到了缓存问题。我在django1.6中读到了cachedstaticfilestorage,它看起来很完美。我修改了我的设置.py设置如下:
STATIC_ROOT = 'staticfiles'
STATIC_URL = ''
# Additional locations of static files
STATICFILES_DIRS = (
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.CachedStaticFilesStorage'
作为测试,我重写了最有问题的css标记,看看它是否会开始散列文件路径。相反,每当我尝试加载页面时,都会出现500个错误。在
你知道我哪里出错了吗?我还错过了一个步骤吗?在
模板中的条目:
^{pr2}$
很狡猾。。。如果你仔细阅读这些文件,你会学到:
所以不是:
使用
^{pr2}$这在Django 1.10中已修复,如documentation中所述:
相关问题 更多 >
编程相关推荐