1

Recently, my DB on my server has shat the bed. I imagine the mistake was somewhere on my end and my wagtail database ended up being wiped clean. I've managed to get my sqlite db working again but my collectstatic is still failing.

I have tried renaming my static folder using mv static staticold and reran python manange.py collecstatic but it still fails.

The error message reads:

Post-processing  'scss/main.css' failed! 

...
...
raise ValueError("The file '%s' could not be found with %r." % (filename, self))
ValueError: The file 'images/5f5a5b3515c4dd0c2c455925_110642301_938622823267359_7859124022958180678_n201.jpg' could not be found with <django.contrib.staticfiles.storage.ManifestStaticFilesStorage object at 0x7f00badf6f60>.`

I don't really care about these old images, though I would like my js and css files to be updated with collectstatic

Martin Massera
  • 1,718
  • 1
  • 21
  • 47
invrt
  • 689
  • 6
  • 24
  • 2
    Are you using `ManifestStaticFilesStorage`? (`STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'`). That sounds like an error that it gives when it has a problem finding a file when `collectstatic` is run. You could comment out this line if it's in your settings and then try running `collectstatic`. You would then just have to ensure that the file it can't find is put into place or else remove the reference to it if it's not needed. – Dan Swain Jan 18 '22 at 20:46
  • Is the filename 'images/5f5a5b3515c4dd0c2c455925_110642301_938622823267359_7859124022958180678_n201.jpg' referenced from somewhere in your CSS files, by any chance? – gasman Jan 18 '22 at 21:03
  • 1
    Removing that line solved it! Thanks man. You should post as answer and I'll mark it – invrt Jan 18 '22 at 21:04
  • @invrt Answer posted – Dan Swain Jan 19 '22 at 15:35

1 Answers1

2

Are you using ManifestStaticFilesStorage? As in:

STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'

That sounds like an error that it gives when it has a problem finding a file when collectstatic is run.

You could comment out that line if it's in your settings and then try running collectstatic. You would then just have to ensure that the file it can't find is put into place or else remove the reference to it if it's not needed in order to continue using ManifestStaticFilesStorage.

I encourage you to use ManifestStaticFilesStorage because it ensures that you have a unique version of your static files with every deployment. This ensures that users always receive the most recent version of a static file.

Martin Massera
  • 1,718
  • 1
  • 21
  • 47
Dan Swain
  • 2,910
  • 1
  • 16
  • 36