#27590: Allow configuration of where to save staticfiles manifest.
-------------------------------------+-------------------------------------
     Reporter:  David Sanders        |                    Owner:  Jarosław
         Type:                       |  Wygoda
  Cleanup/optimization               |                   Status:  assigned
    Component:  contrib.staticfiles  |                  Version:  1.10
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  1
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

 * needs_better_patch:  0 => 1
 * needs_docs:  0 => 1


Comment:

 I think we need to look at where we're headed before we simply add a
 setting here. If we consider the upgrade path, what we don't want to do is
 add a new setting and then need to deprecate it as soon as we improve the
 configuration options, with something along the lines of #26029.

 #26029 is needed because you currently need to provide a storage subclass
 in order to provide configuration parameters:

 {{{
 # In settings.py, where `CustomStorage` adjusts configuration in
 `__init__()`.
 STATICFILES_STORAGE = 'my_app.CustomStorage'
 }}}

 The complaint in #26029 is that providing the subclass is cumbersome, and
 we should be able to specify a dictionary like `DATABASES` and so on.
 But we should solve that problem over there.

 The issue here is that `ManifestStaticFilesStorage` has no way of
 specifying where to store the manifest.

 There's a
 [https://code.djangoproject.com/attachment/ticket/27541/manifest_storage.patch
 patch file] for #27541 (which I'm going to close as a duplicate of this
 ticket) which suggests adding an optional `manifest_storage` kwarg to
 `ManifestFilesMixin` — here you'd pass a configured storage to override
 where to store the manifest file:

 {{{
 # Something like...
 class CustomManifestStorage(ManifestStaticFilesStorage):
     def __init__(self, *args, **kwargs):
         manifest_storage = FileSystemStorage(
             location='path/for/manifest'
         )
         super().__init__(*args, manifest_storage=manifest_storage,
 **kwargs)
 }}}

 Using a storage covers the ''separate s3 bucket'' use-case (and similar)
 but also avoids the cumbersome
 [https://github.com/django/django/pull/12187/files#diff-
 f5c7100e3528e9f6edb98cd5a3d33133bdde6286a89fa472f89980fb07364a8eR366
 ManifestHandler wrapper from the initial PR here].

 I think with that, and tests, and documentation of the new parameter, with
 an example of how to configure it, we have a fix here. (That the
 configuration is a little cumbersome would hopefully spur renewed interest
 in pushing forward with #26029.)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/27590#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.5c8da068de76e6da9d760c5ae22ded53%40djangoproject.com.

Reply via email to