Skip to content
This repository has been archived by the owner on Jan 9, 2018. It is now read-only.

Added option into collectstatic command to ignore post-processing errors #17

Closed
wants to merge 11 commits into from
Closed

Conversation

zyegfryed
Copy link
Contributor

Added option into collectstatic command to ignore errors raised on post-processing phase when files are missing.
This way we can still continue to post-process the static files even when some files are missing. I've stumbled upon this issue when deploying last stable version of django-grappelli.

…st-processing phase when files are missing.
@zyegfryed
Copy link
Contributor Author

This option is also quite handy when using comment in CSS; because the cache storage doesn't care whether the url declaration in the CSS file is in a comment or not. So, a missing file from a commented declaration is legal from my side.

@philipn
Copy link

philipn commented Oct 25, 2011

I'm seeing this, too. We've got some CSS that's got url()'s that refer to assets that are, say, served via an HttpRedirect in django-land and staticfiles barfs on them.

I guess one question is: should ignoring the errors be the default behavior? Personally, I think it makes sense to just ignore the url errors.

@zyegfryed
Copy link
Contributor Author

@philipn Honestly, i prefer errors raised by default, this way i'm informed in the first place an i know exactly what i'm doing when i'm ignoring them.
Let's think this way : raising error - on missing files - is by default the good way. It follow the zen of python :

  • Errors should never pass silently.
  • Unless explicitly silenced.
    The second item is the purpose of the ignore flag.
    And last but not least : raising exception by default allow you to fix your CSS from missing files - because we always miss something up when refactoring, etc. And ignoring this error on the first place will generate 404 page on your production server, you will never notice it unless you look at your server log.

@philipn
Copy link

philipn commented Oct 26, 2011

Totally agree with you about errors. This isn't necessarily an error, though. An exception is raised, but it's not always the case that there's anything wrong with the CSS or with the application. Sometimes the file may not be on the file system and that wasn't intended (as in your 404 example), but it could very well /not/ be producing a 404 -- it could just be served dynamically and not from the file system (this is what I was seeing).

But I think it's fine either way.

@jezdez
Copy link
Owner

jezdez commented Nov 4, 2011

This looks like a good idea, but needs tests :)

EDIT: and docs!

@zyegfryed
Copy link
Contributor Author

OK, i'll add some tests and ping you back once done.
Thanks for having review this patch.

EDIT: Arg, i'm so bad at docs :) Will be the occasion to tackle it.

@willhardy willhardy mentioned this pull request Nov 8, 2011
@zyegfryed
Copy link
Contributor Author

@jezdez I've added tests and docs.
Thanks in advance for your feedback.

zyegfryed added 3 commits March 24, 2012 22:29
When a file exists in many directories included in STATICFILES_DIRS,
every files found were processed, and the last one was used fro the
post-processing phase. According to the precedence, only the first
file found should be (post-)processed.
@zyegfryed
Copy link
Contributor Author

I'm closing this pull request because it nos comes with a patch for #19.
I'll try to make two different ones.

@zyegfryed zyegfryed closed this Apr 4, 2012
@zyegfryed zyegfryed reopened this Apr 4, 2012
@zyegfryed
Copy link
Contributor Author

Opening back, since i'm struggling too much with github.

@zyegfryed
Copy link
Contributor Author

@jezdez bump !

@mivanov
Copy link

mivanov commented Aug 22, 2012

Another bump, would be very helpful to support this.

@leff
Copy link

leff commented Jan 24, 2013

another bump. I would really like to see this in core. Even better would be an option to log warnings instead of failing silently.

@raianul
Copy link

raianul commented Feb 28, 2014

Another bump. suffering too much badly. would be very helpful. btw I am using Dj-1.6.1 from django.contrib.staticfiles

@david-martel-evimbec
Copy link

What is the exact option to make this work ?

@zyegfryed zyegfryed closed this by deleting the head repository Feb 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants