0

I'm having trouble with django-pipeline which requires you to set the

settings.STYLUS_BINARY for the stylus compiler.

In my settings.py I have the following:

STYLUS_BINARY = os.path.join(BASE_DIR, 'node_modules', '.bin', 'stylus')

If I print this to the console I see the folder:

c:/Users/chowza/myproject/node_modules/.bin/stylus

However, if I dig into the django-pipeline module that actually uses settings.STYLUS_BINARY and add a print there I see the following when printing settings.STYLUS_BINARY:

('usr/bin/env/','stylus')

That is what the default path of STYLUS_BINARY is set to according to django-pipeline

At the top of this module is a function that says from pipeline.conf import settings so I assume my settings file is being imported.

That tells me that my settings.STYLUS_BINARY is not set.

I am using python manage.py collectstatic --settings myproject.settings so that I can compile stylus files to css with settings.STYLUS_BINARY.

So my question is why is the settings variable not set? what am I doing wrong?

Note: this was tested on Windows and on Heroku deployment

Terence Chow
  • 10,755
  • 24
  • 78
  • 141
  • Do you get any error logs ? – JClarke Apr 10 '16 at 18:40
  • @Jclarke the error is a non descript error saying a file is missing when running django-pipeline's stylus_compiler, hence I went to print the location of the `settings.STYLUS_BINARY` in the stylus_compiler and found it say `/user/bin/env/` instead of `c:/users/chowza/myproject/node_modules/.bin/stylus` which is what I would expect given that I wrote that in my settings file – Terence Chow Apr 10 '16 at 18:46
  • Hey i just tested it got the same error. I updated my compressors and the error went away and all the files that weren't collected were collected. – JClarke Apr 10 '16 at 19:25
  • @Jclarke what do you mean updated your compressors? My compressors are npm installed as of last week. I can't imagine them out of date. – Terence Chow Apr 10 '16 at 19:34
  • I meant in the settings. I'd ignore it though. – JClarke Apr 10 '16 at 20:46

1 Answers1

0

Spent a couple days on this. Wasted a lot of time.

Libraries that have bad documentation suck.

in settings.py

STYLUS_BINARY = os.path.join(BASE_DIR, 'node_modules', '.bin', 'stylus')

should be:

PIPELINE['STYLUS_BINARY'] = os.path.join(BASE_DIR, 'node_modules', '.bin','stylus'),

This is assuming you have a node_modules/.bin/stylus. The important thing is that it is not set as a constant but as a hash of PIPELINE.

Terence Chow
  • 10,755
  • 24
  • 78
  • 141