question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How not to have the source files collected in `STATIC_ROOT` ?

See original GitHub issue

Currently upgrading from django-pipeline 1.3.27 to 1.6.6.

The new default configuration works fine except that I ended with too many files collected in STATIC_ROOT.

Ok, so heading to the documentation, storage section:

If you want to exclude Pipelinable content from your collected static files, you can also use Pipeline’s FileSystemFinder and AppDirectoriesFinder. These finders will also exclude unwanted content like READMEs, tests and examples, which are particularly useful if you’re collecting content from a tool like Bower.

Nice, so I’ll try using pipeline.finders.FileSystemFinder and pipeline.finders.AppDirectoriesFinder instead of their django versions but now the compiling / compressing part no longer works because the compilers / compressors are looking for the source files in STATIC_ROOT where there are no longer collected as wanted.

So now I collect the files I need + the source files, then run pipeline and finally remove the source files from STATIC_ROOT but it just feels not right. (plus it’s not really fixed, if I have source.scss compiled to source.css compressed to output.css, I’m still ending up with an unwanted source.css in STATIC_ROOT).

Previously we had pipeline.storage.PipelineFinderStorage who used all the finders without the ignore_patterns to find and use all the source files no matter if they were collected in STATIC_ROOT in the end. This Storage was removed when pipeline.collector.default_collector was introduced (I’m still confused about it’s purpose) and replaced by django’s stock staticfiles_storage who cannot find the source files if they’re not copied in STATIC_ROOT.

Related issues: https://github.com/jazzband/django-pipeline/issues/504 https://github.com/jazzband/django-pipeline/issues/503 but they have not attracted any response.

I’ll would be glad if someone could point me in the right direction. Am I wrongly using django-pipeline ? Because if not, at that point I may as well directly fix django-pipeline than hack around it but I would need some guidelines from a maintainer before starting to do so.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:5
  • Comments:8

github_iconTop GitHub Comments

4reactions
harmoncommented, Sep 28, 2016

Yeah, I just upgraded from 1.3x and things broke for me in dev. I had to set:

DEBUG = True PIPELINE[‘PIPELINE_ENABLED’] = False PIPELINE[‘PIPELINE_COLLECTOR_ENABLED’] = True

The switch to forcing files to be copied to STATIC_ROOT instead of just read from the original source dirs seems like an bad change. Every request requires it all to be recopied. It’s pretty slow in dev now. AND it copies in all the .scss and .coffee files, since they need to be there for compilation, but aren’t cleaned up afterwards. ACK!

The issue is this change from compiling from the source file path to compiling once it’s in STATIC_ROOT: https://github.com/jazzband/django-pipeline/commit/bd6b9d8966a5e00701d3a803c4977f20df7a282d#diff-54b8c27056913aafe149e01ff0aa5e46L35

I’d love to see a bit better documentation on how to setup a development environment.

3reactions
czubik8805commented, Sep 6, 2016

In the older version of pipeline was possible to call collectstatic command with ignore parameter e.g:

./manage.py collectstatic --ignore=*.sass --ignore=*.coffee

But now it throws exception

pipeline.exceptions.CompilerError: ['/usr/local/bin/sass', u'/home/michal/project/static/css/styles_commons.sass', u'/home/michal/project/static/css/styles_commons.css'] exit code 1
Errno::ENOENT: No such file or directory @ rb_sysopen - /home/michal/project/static/css/styles_commons.sass
  Use --trace for backtrace.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Static_Root in settings.py redirecting to my static folder in app ...
According to your current settings (considering you have not changed BASE_DIR). You telling django to look for static files in a folder ...
Read more >
How to manage static files (e.g. images, JavaScript, CSS)
Make sure that django.contrib.staticfiles is included in your INSTALLED_APPS . ... assumes the static content has already been collected under STATIC_ROOT .
Read more >
Working with Static and Media Files in Django | TestDriven.io
Types of Files · Source code: These are your core Python modules and HTML files that make up every Django project, where you...
Read more >
Django Static Files Handling made Simple - DataFlair
Static files contain all kinds of file types – from .mpeg, .jpeg to .pdf, etc. ... Here, you can note that we are...
Read more >
Managing static files — Django v1.3.1 documentation
That's what django.contrib.staticfiles is for: it collects static files from ... to make your MEDIA_ROOT and MEDIA_URL different from your STATIC_ROOT and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found