I'm trying to upgrade an existing application to use a Manifest based 
StaticStorage so we can leverage long-term caching.

It works as expected for files included with the `static from staticfiles` 
template tag: my app shows the hashed names for the standard admin 
javascript/css files and they all resolve correctly.

But for (admin) widgets that add extra media files using the Media class 
<https://docs.djangoproject.com/en/1.8/topics/forms/media/> I still get the 
plain (non-hash) filenames in my HTML.

I tried this with both the bundled ManifestStaticStorage as well as 
ManifestStaticS3Storage from django-s3-storage. 
<https://github.com/etianen/django-s3-storage>

Curiously the URLs are formed differently: for example: the ones from the 
template tags have different URLS then the ones from Media classes:

<script type="text/javascript" 
src="https://s3-eu-west-1.amazonaws.com:443/my-project/static/admin/js/actions.min.2893760b9e40.js";></script>
<script type="text/javascript" 
src="https://s3-eu-west-1.amazonaws.com/my-project/static/js/my_custom_scipt.js";></script>

The second one corresponds with what I have set as STATIC_URL, while to 
first one seems to be generated by the S3 storage (it has an explicit port 
number). I see these non-transformed URLs for all media attached by myself 
or third-party widgets.


Next I looked into the source on Github, and this confirms my fear that 
form-media urls are simply joined to the STATIC_URL instead of passed 
through the staticfiles manifest mechanism.

For example: 
https://github.com/django/django/blob/f59a0401e5d0e19568a038f2a50954d1a9a1526f/django/forms/widgets.py#L80-L85


Doesn't this kinda defeats the purpose of using the staticfiles app and 
Manifest Storage if a fair part of our static files are not processed by 
it? Or do I miss some override or setting?

All this was using Django 1.8.6 with Python 3.4 on Ubuntu.


Any ideas what is intended here?


Bart

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a25d23df-5012-4054-b991-68114713a5f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to