Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django-Compressor cannot find files when it's actually there

I just installed django-compressor to my project and I am getting below error message.

TemplateSyntaxError at / Caught UncompressableFileError while rendering: 'js/jquery-1.7.2.min.js' could not be found in the COMPRESS_ROOT '/Users/taelimoh/Dropbox/gluwa-git/static' or with staticfiles.

This also happens when I try to compress css files.

Of course, the files are there and it works fine when I don't try to compress them with django-compressor.

below is my template

...
    {% compress js %}
        <!--Javascripts-->
        <!--Libraries-->
        <script type="text/javascript" src="/static/js/jquery-1.7.2.min.js"></script>
    {% endcompress %}
...

and this is my 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
    ...
)

I am using google app engine and my django version is 1.3. The issue was produced on my development server.

like image 557
taelimoh Avatar asked Oct 08 '12 02:10

taelimoh


1 Answers

This might be a bit late, but the documentation states that any files that are configured with a static handler in your app.yaml aren't readable by the application. Thankfully, there's also a switch to enable your application to read these files. You can read about it here. In essence, you'd want to do this

handlers:
- url: /static
- static_dir: staticfiles
- application_readable: true

in your app.yaml (note the application_readable). I struggled with this for a while because os.path.exists was always failing. Hope this helps.

like image 124
slurms Avatar answered Sep 30 '22 17:09

slurms