Skip to content

Conversation

@jochenklar
Copy link
Member

This PR overwrites the regular Django static template tag to add the current RDMO version (if DEBUG = False). The result is that clients will drop the cached files when the version changes (aka. cache busting). There are some remarks around to not use query params for this (pointing to https://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/), but I don't think this is relevant for us.

We might to switch to [whitenoise}(https://whitenoise.readthedocs.io/en/latest/) at some point, but we need to fix our JS and CSS pipeline first and get rid of compressor.

@jochenklar jochenklar requested a review from MyPyDavid January 16, 2026 12:29
@jochenklar jochenklar self-assigned this Jan 16, 2026
@jochenklar jochenklar added this to the RDMO 2.5.0 milestone Jan 16, 2026
@jochenklar
Copy link
Member Author

It is actually a bad idea to override the template tag. There are custom storage classes for this. ManifestStaticFilesStorage would also be an idea, but would also have the same issues as whitenoise.

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.

@jochenklar jochenklar changed the title Overwrite static tag to include version Add version to static files in production Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants