我刚刚在我的项目中安装了django-压缩程序,我得到了下面的错误消息。
在呈现时,TemplateSyntaxError在/捕捉到UncompressableFileError:‘js/jQuery1.7.2.min.js’无法在COMPRESS_ROOT /User/taelimoh/Dropbox/gluwa/staticfile或静态文件中找到。
当我试图压缩css文件时,也会发生这种情况。
当然,当我不尝试用django压缩器压缩它们时,文件就在那里,而且工作正常。
下面是我的模板
...
{% 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。这个问题是在我的开发服务器上产生的。
发布于 2014-07-17 00:15:23
这可能有点晚,但文档指出,在您的app.yaml中配置了静态处理程序的任何文件都不能被应用程序读取。谢天谢地,还有一个开关可以让应用程序读取这些文件。你可以读到它,这里。从本质上说,你会想要这样做
handlers:
- url: /static
- static_dir: staticfiles
- application_readable: true在您的app.yaml中(注意application_readable)。我为此挣扎了一段时间,因为os.path.exists总是失败。希望这能有所帮助。
发布于 2012-10-08 05:10:54
GAE应用程序对文件没有写权限。如果Django-压缩程序试图将压缩文件写入文件系统,那将失败。
https://stackoverflow.com/questions/12774696
复制相似问题