Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions rdmo/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@
'compressor.finders.CompressorFinder',
)

STATICFILES_STORAGE = 'rdmo.core.storage.VersionedStaticFilesStorage'

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
Expand Down
18 changes: 18 additions & 0 deletions rdmo/core/storage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from django.conf import settings
from django.contrib.staticfiles.storage import StaticFilesStorage

from rdmo import __version__


class VersionedStaticFilesStorage(StaticFilesStorage):

def url(self, name):
url = super().url(name)

if settings.DEBUG:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't have a if settings.DEBUG check anywhere in rdmo yet, should this not go in the rdmo-app?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I think its fine. settings.DEBUG is pretty low-level django. So far we did not need it.

return url
else:
if '?' in url:
return f'{url}&v={__version__}'
else:
return f'{url}?v={__version__}'
Loading