我刚刚将 django-compressor 安装到我的项目中,并且收到以下错误消息。
TemplateSyntaxError at / Caught UncompressableFileError while rendering: 'js/jquery-1.7.2.min.js' 无法在 COMPRESS_ROOT '/Users/taelimoh/Dropbox/gluwa-git/static' 或静态文件中找到。
当我尝试压缩 css 文件时也会发生这种情况。
当然,这些文件在那里,当我不尝试使用 django-compressor 压缩它们时它工作正常。
下面是我的模板
...
{% compress js %}
<!--Javascripts-->
<!--Libraries-->
<script type="text/javascript" src="/static/js/jquery-1.7.2.min.js"></script>
{% endcompress %}
...
这是我的 settings.py
COMPRESS_ENABLED = True
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.humanize',
##############################################
'appconf',# required by django-compressor
'versiontools',# required by django-compressor
'compressor',#https://github.com/jezdez/django_compressor
...
)
我正在使用谷歌应用引擎,我的 django 版本是 1.3。该问题是在我的开发服务器上产生的。