Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Django Compressor #262

Open
firesharkstudios opened this issue Oct 31, 2016 · 1 comment
Open

Using Django Compressor #262

firesharkstudios opened this issue Oct 31, 2016 · 1 comment

Comments

@firesharkstudios
Copy link

I'm trying to use Django Compressor (http://django-compressor.readthedocs.io/en/latest/quickstart/) with Cactus.

I've done the following...

  1. Run "pip install django-compressor" from a command line

  2. Modified the "INSTALLED_APPS" variable in site-packages/Cactus/site.py to have the value ['django_markwhat', 'compressor']

  3. Added this to my base.html...

{% load compress %}

{% compress css %}
<link rel="stylesheet" href="/static/css/one.css" type="text/css" charset="utf-8">
<style type="text/css">p { border:5px solid green;}</style>
<link rel="stylesheet" href="/static/css/two.css" type="text/css" charset="utf-8">
{% endcompress %}

Running 'cactus serve' then results in this error...

django.template.base.TemplateSyntaxError: 'compress' is not a valid tag library: ImportError raised loading compressor.templatetags.compress: cannot import name caches

Unfortunately, I'm really not that familiar with Django to troubleshoot this well. Any ideas how to fix this or otherwise get a CSS/JS minifier/combiner working with Cactus?

@153957
Copy link
Contributor

153957 commented Dec 5, 2017

You will probably need an older version of Django-compressor that works with Django < 1.7.

From the Django-compressor readme:

Django Compressor is compatible with Django 1.8 and newer.
So it tries to import something from django (django.core.cache.caches) but that did not exist in Django<1.7.

Try installing django-compressor 1.6, since after that support for those old Django versions was dropped: http://django-compressor.readthedocs.io/en/latest/changelog/#v2-0-2016-01-07

Try pip install 'django-compressor==1.6 (first pip uninstall django-compressor to remove the already installed version)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants