Deprecating CachedStaticFilesStorage in Django 2.0

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Deprecating CachedStaticFilesStorage in Django 2.0

emorley
Hi!

Currently when using `ManifestStaticFilesStorage`, collectstatic generates duplicate versions of some files. For example looking at the output for contrib.admin for Django 1.11.5, there is:
- admin/css/base.css
- admin/css/base.5af66c1b1797.css
- admin/css/base.6b517d0d5813.css
- admin/css/base.31652d31b392.css

This is exacerbated when using something like WhiteNoise's CompressedStaticFilesMixin, which then has to spend extra time generating gzip and Brotli compressed versions of every file (or else try and work around it).

I was going to file a ticket about fixing this, however it appears to be unavoidable/working as intended according to:
https://code.djangoproject.com/ticket/24452#comment:16

In that ticket and corresponding PR, it's mentioned several times that CachedStaticFilesStorage is suboptimal and should probably be removed, and if that occurred it would then be possible to avoid the duplication.

As such, I'd like to propose that `CachedStaticFilesStorage` be marked as deprecated for the Django 2.0 release (with the warning suggesting people use `ManifestStaticFilesStorage` instead), so we could then remove it and make these optimisations in Django 3.0.

Thoughts?

Many thanks,

Ed

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/b5a12c9b-ab4b-4431-b633-43a0ddfdd534%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Deprecating CachedStaticFilesStorage in Django 2.0

Adam Johnson-2
(For some reason GMail is clipping your message before any content, I only saw '... [Message clipped]' and had to click to see it all)

I'm not that familiar with the static file storages, but it seems to me like it's not going to be that controversial deprecate it in order to save this duplication. The docs do read:

CachedStaticFilesStorage isn’t recommended – in almost all cases ManifestStaticFilesStorage is a better choice.

On 15 September 2017 at 17:58, <[hidden email]> wrote:
Hi!

Currently when using `ManifestStaticFilesStorage`, collectstatic generates duplicate versions of some files. For example looking at the output for contrib.admin for Django 1.11.5, there is:
- admin/css/base.css
- admin/css/base.5af66c1b1797.css
- admin/css/base.6b517d0d5813.css
- admin/css/base.31652d31b392.css

This is exacerbated when using something like WhiteNoise's CompressedStaticFilesMixin, which then has to spend extra time generating gzip and Brotli compressed versions of every file (or else try and work around it).

I was going to file a ticket about fixing this, however it appears to be unavoidable/working as intended according to:

In that ticket and corresponding PR, it's mentioned several times that CachedStaticFilesStorage is suboptimal and should probably be removed, and if that occurred it would then be possible to avoid the duplication.

As such, I'd like to propose that `CachedStaticFilesStorage` be marked as deprecated for the Django 2.0 release (with the warning suggesting people use `ManifestStaticFilesStorage` instead), so we could then remove it and make these optimisations in Django 3.0.

Thoughts?

Many thanks,

Ed

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/b5a12c9b-ab4b-4431-b633-43a0ddfdd534%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Adam

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMyDDM3q9DgEqMNV%3DtwU%2BajbzodOZnyeTH_h%3DnQbjE0n4DK3LQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Deprecating CachedStaticFilesStorage in Django 2.0

Tim Graham-2
In reply to this post by emorley
About the timing, it's too late to get this in to Django 2.0 as the feature freeze is on Monday and I already have a large queue of review work to do before then. I don't think it makes much difference since features deprecated in both Django 2.0 and 2.1 will be removed in Django 3.0.

On Friday, September 15, 2017 at 12:58:44 PM UTC-4, [hidden email] wrote:
Hi!

Currently when using `ManifestStaticFilesStorage`, collectstatic generates duplicate versions of some files. For example looking at the output for contrib.admin for Django 1.11.5, there is:
- admin/css/base.css
- admin/css/base.5af66c1b1797.css
- admin/css/base.6b517d0d5813.css
- admin/css/base.31652d31b392.css

This is exacerbated when using something like WhiteNoise's CompressedStaticFilesMixin, which then has to spend extra time generating gzip and Brotli compressed versions of every file (or else try and work around it).

I was going to file a ticket about fixing this, however it appears to be unavoidable/working as intended according to:
<a href="https://code.djangoproject.com/ticket/24452#comment:16" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F24452%23comment%3A16\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHxal25KxvWRW-mUrbTPa2wNzRaSw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F24452%23comment%3A16\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHxal25KxvWRW-mUrbTPa2wNzRaSw&#39;;return true;">https://code.djangoproject.com/ticket/24452#comment:16

In that ticket and corresponding PR, it's mentioned several times that CachedStaticFilesStorage is suboptimal and should probably be removed, and if that occurred it would then be possible to avoid the duplication.

As such, I'd like to propose that `CachedStaticFilesStorage` be marked as deprecated for the Django 2.0 release (with the warning suggesting people use `ManifestStaticFilesStorage` instead), so we could then remove it and make these optimisations in Django 3.0.

Thoughts?

Many thanks,

Ed

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/9e875088-6647-4923-a53f-bd97d20262c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Deprecating CachedStaticFilesStorage in Django 2.0

emorley
On 15 September 2017 at 18:26, Adam Johnson <[hidden email]> wrote:
(For some reason GMail is clipping your message before any content, I only saw '... [Message clipped]' and had to click to see it all)

This must be due to using the Google Groups interface for posting - I'll stick to email from now on :-)

On 15 September 2017 at 18:36, Tim Graham <[hidden email]> wrote:
About the timing, it's too late to get this in to Django 2.0 as the feature freeze is on Monday and I already have a large queue of review work to do before then. I don't think it makes much difference since features deprecated in both Django 2.0 and 2.1 will be removed in Django 3.0.

Ah ok - I didn't realise features deprecated in Django 2.0 and 2.1 would both be eligible for removal at the same time; re-reading the deprecation policy [1] I see now it's only Django 2.2 deprecations that would get deferred to Django 3.1.

Given it sounds like this deprecation might be feasible, I've filed a ticket for doing so in Django 2.1:

And another for making ManifestStaticFilesStorage not leave the intermediate files behind:

Many thanks,

Ed

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMtUAxvb2GSwCEztSgPKzatLj03HE%2BAXpcPTCjhY5-%3DiLXQK9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Deprecating CachedStaticFilesStorage in Django 2.0

Tim Graham-2
In reply to this post by emorley
The documentation says that CachedStaticFilesStorage "is mostly useful for situations in which you don't have access to the file system." What should be used for that situation if CachedStaticFilesStorage is removed?

On Friday, September 15, 2017 at 12:58:44 PM UTC-4, [hidden email] wrote:
Hi!

Currently when using `ManifestStaticFilesStorage`, collectstatic generates duplicate versions of some files. For example looking at the output for contrib.admin for Django 1.11.5, there is:
- admin/css/base.css
- admin/css/base.5af66c1b1797.css
- admin/css/base.6b517d0d5813.css
- admin/css/base.31652d31b392.css

This is exacerbated when using something like WhiteNoise's CompressedStaticFilesMixin, which then has to spend extra time generating gzip and Brotli compressed versions of every file (or else try and work around it).

I was going to file a ticket about fixing this, however it appears to be unavoidable/working as intended according to:
<a href="https://code.djangoproject.com/ticket/24452#comment:16" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F24452%23comment%3A16\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHxal25KxvWRW-mUrbTPa2wNzRaSw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F24452%23comment%3A16\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHxal25KxvWRW-mUrbTPa2wNzRaSw&#39;;return true;">https://code.djangoproject.com/ticket/24452#comment:16

In that ticket and corresponding PR, it's mentioned several times that CachedStaticFilesStorage is suboptimal and should probably be removed, and if that occurred it would then be possible to avoid the duplication.

As such, I'd like to propose that `CachedStaticFilesStorage` be marked as deprecated for the Django 2.0 release (with the warning suggesting people use `ManifestStaticFilesStorage` instead), so we could then remove it and make these optimisations in Django 3.0.

Thoughts?

Many thanks,

Ed

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/a8d0623a-4962-4f1a-a5f8-41372fdb7a18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Deprecating CachedStaticFilesStorage in Django 2.0

Kevin Christopher Henry
I believe the typical approach is to use one of several third-party packages that uses cloud storage (e.g. django-s3-storage).

Were you thinking of adding a note to the documentation? I guess the question is where to put it, since it's more of a File Storage API issue than something specific to staticfiles. Still, I suspect a lot more people look at the staticfiles documentation than the File Storage API documentation, and they are probably more likely to need the advice.

Cheers,
Kevin

On Monday, January 15, 2018 at 7:13:22 AM UTC-8, Tim Graham wrote:
The documentation says that CachedStaticFilesStorage "is mostly useful for situations in which you don't have access to the file system." What should be used for that situation if CachedStaticFilesStorage is removed?

On Friday, September 15, 2017 at 12:58:44 PM UTC-4, [hidden email] wrote:
Hi!

Currently when using `ManifestStaticFilesStorage`, collectstatic generates duplicate versions of some files. For example looking at the output for contrib.admin for Django 1.11.5, there is:
- admin/css/base.css
- admin/css/base.5af66c1b1797.css
- admin/css/base.6b517d0d5813.css
- admin/css/base.31652d31b392.css

This is exacerbated when using something like WhiteNoise's CompressedStaticFilesMixin, which then has to spend extra time generating gzip and Brotli compressed versions of every file (or else try and work around it).

I was going to file a ticket about fixing this, however it appears to be unavoidable/working as intended according to:
<a href="https://code.djangoproject.com/ticket/24452#comment:16" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F24452%23comment%3A16\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHxal25KxvWRW-mUrbTPa2wNzRaSw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F24452%23comment%3A16\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHxal25KxvWRW-mUrbTPa2wNzRaSw&#39;;return true;">https://code.djangoproject.com/ticket/24452#comment:16

In that ticket and corresponding PR, it's mentioned several times that CachedStaticFilesStorage is suboptimal and should probably be removed, and if that occurred it would then be possible to avoid the duplication.

As such, I'd like to propose that `CachedStaticFilesStorage` be marked as deprecated for the Django 2.0 release (with the warning suggesting people use `ManifestStaticFilesStorage` instead), so we could then remove it and make these optimisations in Django 3.0.

Thoughts?

Many thanks,

Ed

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/e9429c75-902e-4969-9b3f-5c0f8134a50a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.