compiler

from django_libsass import SassCompiler

Following on from the Error during Template Rendering, I still have not solved why I get a

Exception Value:
'module' object has no attribute 'compile'

as previous analyzed, I suspect it means sass is not recognized as a module. But having posted the question on StackOverflow, one of the Wagtail guys have replied :

“…Indicates that Django Compressor is trying to run django_libsass.SassCompiler as a shell command, and the script is failing to run.” – This is a red herring. Django-compressor first tries to interpret the string as a python module, and if that fails (as apparently it is doing here), it falls back on treating it as a shell command. It shouldn’t be necessary to install a command-line Sass tool to use Wagtail – the django-libsass library should be handling it entirely on the Python side.” – gasman

Looks like I’m looking at the wrong stuff then!

 

He also commented:

What error message (if any) do you get if you run from django_libsass import SassCompiler within manage.py shell? –  gasman

I went back into shell, ran

python manage.py shell

Python 2.7.6 (default, Nov 11 2013, 18:34:29)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
(InteractiveConsole)
>>> from django_libsass import SassCompiler

Did not get any errors there, which means django_libsass and SassCompiler are both working and the errors lies elsewhere. Will have to go strain my eyes and poke at that riddle.

Advertisements

Error during template rendering

Picture 18

 

Error during template rendering

In template /home/username/env/lib/python2.7/site-packages/wagtail/wagtailadmin/templates/wagtailadmin/skeleton.html, error at line 20

‘module’ object has no attribute ‘compile’

 

This is what I’m stuck at now.

line 20 = {% compress css %}

in my admin skeleton.html

Which means the error links back to the Compressor.

Digging through the traceback logs reveal:

51. return compile(filename=self.filename)
File “/home/username/env/lib/python2.7/site-packages/django_libsass.py” in compile
41. return sass.compile(**kwargs)

Exception Type: AttributeError at /admin/login/
Exception Value: ‘module’ object has no attribute ‘compile’

Django_libsass is a django-compressor filter to compile SASS files using libsass, written by torchbox, the same guys who wrote Wagtail.

‘module’ object refers to sass in line 41.

either it does not recognize sass, or there is no compile class within sass for django_libsass to call and hence this error.

Possible Actions:

  1. Check dependencies and requirements are properly installed
  2. Check that django_libsass is on path and python path
  3. Find out where is sass.
  4. Do I have to pip install sass or is it within django_libsass?
  5. Find if compile is defined in sass, wherever that is
  6. See if I can run sass and compile in command line
  7. List django_libsass in settings.py as a ‘module’