By default, ManifestStaticFilesStorage
only returns urls with hashes in them when DEBUG=False
. I want my development environment to be as close to production as possible, but I do need to set debug to False for a couple of things during development. Is there a way to tell ManifestStaticFilesStorage
to always give me the url with hash?
You could override the url
method of ManifestStaticFilesStorage
so that it always gives you the url with the hash.
from django.contrib.staticfiles.storage import ManifestStaticFilesStorage
from django.conf import settings
class BigBlindManifestStaticFilesStorage(ManifestStaticFilesStorage):
def url(self, name, force=True):
"""
Override .url to use hashed url in development
"""
return super(ManifestStaticFilesStorage, self).url(name, True)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With