Make Django's collectstatic command forgiving

Jan 29, 2019 · Updated: Jul 12, 2021 · by Tim Kamanin

Have this ever happened to you? You run a python collecstatic command, it progresses for some time and then throws an error, something like:

console output
ValueError: The file 'theme/startup/css/font/ytp-regular.eot' 
could not be found with 
< object at 0x10b47cc50>

Well, that means, your staticfiles storage collector couldn't find a file declared somewhere deep in CSS. Sometimes this error is a piece of useful information, but sometimes, it's a guaranteed pain, especially if you use some third-party themes, jquery plugins or as in my case, the Startup framework.

Okay, so now what? If you know that the file is essential you go and fix that missing part, but if you don't care and want the static collector to advance and ignore that missing file?

Well, you need The Forgiving Static Files Storage.

And here's how to make one. By default, in your STATICFILES_STORAGE is set to and it's the class that's responsible for our python collecstatic behavior.

Thus we could extend it and tell it to ignore missing files. Let's do this!

  1. Create a file inside a Django app. I like to have core app inside every Django project I start where I define such application wide logic, so in my case, the file's path is core/

  2. Add the following contents to a file:

    from import ManifestStaticFilesStorage
    class ForgivingManifestStaticFilesStorage(ManifestStaticFilesStorage):
        def hashed_name(self, name, content=None, filename=None):
                result = super().hashed_name(name, content, filename)
            except ValueError:
                # When the file is missing, let's forgive and ignore that.
                result = name
            return result

  3. In set STATICFILES_STORAGE as ForgivingManifestStaticFilesStorage:


  4. Run python collecstatic and see how nicely it finished!



I've created a PyPI package based on this tutorial. The package is called django-forgiving-collectstatic and here's how to use it:

  1. Install from PyPI:

    pip install django-forgiving-collectstatic

  2. Set in your


  3. Run python collecstatic and never worry about missing static files.

Check it out on Github and PyPI.

Hey, if you've found this useful, please share the post to help other folks find it:

There's even more:

Subscribe for updates

  • via Twitter: @timonweb
  • old school RSS:
  • or evergreen email ↓ ↓ ↓