jezdez/django_compressor — Issue #205: Offline compression w/ pre-compiler fails on multi-server deployment
Author: bartek
Created: 2012-02-07 17:22:17+00:00
State: open

Hi there,

I'm running into this issue today and I can't fathom what I could be doing wrong, so I'm going to assume it's a bug.

Setup: One single shared media server, multiple app servers. One server to run the `compress` command after a deploy (Sounds common!)

Everything works, except for my SASS file that I have on a single page. First, here's my settings:

```
COMPRESS_OFFLINE = True
COMPRESS_CSS_HASHING_METHOD = 'content'
COMPRESS_PRECOMPILERS = (
('text/x-scss', 'cd %s; sass {infile} {outfile}' % (MEDIA_ROOT)),
)
```
The culprit template/file (snippet):

```
{% load compress %}

{% block style %}
{{ block.super }}
{% compress css %}

{% endcompress %}
{% endblock %}
```

Now, an example:

1) When I run `manage.py compress` on any of the app servers, it writes to the CACHE directory in the shared media server environment.

2) For this example, I've run this command on `APP1`, and when I run the web server on this machine, and access my pages. Everything is great.

3) If I access the site on `APP2`, which is pointing to the same shared media server, but I have *not* run compress on here (because `APP1` already handled that), then every page that uses a standard css/js works fine, however the page with the block referenced above always fails. The complaint is something along the lines of:

```
TemplateSyntaxError: Caught OfflineGenerationError while rendering: You have offline compression enabled but key "0ae8056dd719c57f5517604e76c8b1a8" is missing from offline manifest. You may need to run "python manage.py compress".
```

I am running off `django_compressor==dev` -- Could this be a similar problem to the one mentioned in #154 re. the checksum calculation?

Thanks!