Question

Okay, I've been learning Django but am a beginner with the framework. I'm a fan. I have a build running on heroku with the static files being served from Amazon S3 using Django-storages. It was very easy to get up and running with no difficulties.

However, I'm missing the calendar icons. Checking the source shows there's no trailing slash between admin & img.

Example:

https://s3.amazonaws.com/heroku-sdbhvaehv/adminimg/icon_clock.gif

Its a bug apparently in Django-storages listed here:

http://code.larlet.fr/django-storages/issue/121/s3boto-admin-prefix-issue-with-django-14

And I've implemented the various fixes that are listed in the comments with no luck.

I've found two posts around on SO and Google Groups but there is no solutions.

Using Django and s3boto, some admin images (icon_clock.gif & icon_calendar.gif) don't display

So -- I'm looking for any solutions on how to get this icon fixed. I don't care if I have to modify something after every push, or do whatever - but I can't have a missing calendar icon.

Any help out there?

Was it helpful?

Solution

The problem is not with boto, or with django-storages.

The problem is that the django admin is missusing the {% static %} tag. The static tag assumes (rightly) that it is viewing the entire url, and that it can modify that url arbitarily. By passing in only a prefix, the django admin is breaking that contract (which will not be detected in the simplest cases, but will be a big problem when you try to do anything more complex.

You should file a bug or patch against django to explicitly pass all asset urls, in full, to the static tag, and dump these full resource URIs into the javascript context.

EDIT: This solution should work for you: http://code.larlet.fr/django-storages/issue/121/s3boto-admin-prefix-issue-with-django-14#comment-1604389

Just make sure you have AWS_QUERYSTRING_AUTH set to False, or you will get querystrings sandwiched in there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top