jazzband / django-tinymce

TinyMCE integration for Django
http://django-tinymce.readthedocs.org/
MIT License
1.28k stars 317 forks source link

Include cache_suffix tinymce parameter in project's static files #465

Open Pantzan opened 5 months ago

Pantzan commented 5 months ago

This PR aims to integrate Tinymce's cache_suffix parameter into Django-tinymce.

The problem: In project deployments it is a common practice to cache static data for long period of time in both proxy (such as Nginx) and browser storage. When a new version of tinymce or django-tinymce is deployed browser cache cannot be cleared on Nginx request. Tinymce includes the cache_suffix setting to solve this problem by appending a url parameter as suffix, for example ?ver=6.8 in each file in order to force the browser to refetch the static files. When the setting is set in TINYMCE_DEFAULT_CONFIG the suffix is not propagated in the compressor nor the init_tinymce static files.

I believe it is useful feature to be included in this project. Dealing with broken forms is a headache after a new release.

If you have any questions or you would like to discuss it further, I will be happy to participate

claudep commented 5 months ago

My feeling is you are re-implementing https://docs.djangoproject.com/en/5.0/ref/contrib/staticfiles/#manifeststaticfilesstorage functionality.

Pantzan commented 5 months ago

We looked up the ManifestStaticFilesStorage. Although with more work the storage can be implemented in global Django space, it will require additional logic to format only the tinymce files if that is the case. We already tried the storage class but it ended up quite hacky and messy so we locally edited this project to complete the migration from tinymce 5 to 6.

I believe as business logic since tinymce offers the cache suffix that should be also propagated into the project's files.