2

All files, including those not displaying correctly, are present in my bucket at amazon. The only two images I've found that don't display are icon_clock.gif and icon_calendar.gif. Everything else works properly.

When I examine the link location of the broken images, I get this:

 https://my_bucket_name.s3.amazonaws.com/admin?Signature=MY_SIGNATURE&AWSAccessKeyId=MY_KEYimg/icon_clock.gif

As you can see, the query parameters aren't being added to the end but instead to the middle of the link.

Here are the relevant settings:

import os.path

ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
PROJECT_NAME = os.path.basename(ROOT_DIR)

def ABS_PATH(*args):
    return os.path.join(ROOT_DIR, *args)

STATIC_ROOT = ABS_PATH('static')

AWS_ACCESS_KEY_ID = 'MY_KEY'
AWS_SECRET_ACCESS_KEY = 'MY_SECRET_ACCESS_KEY'

AWS_STORAGE_BUCKET_NAME = 'my_bucket_name'
STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
S3_URL = 'http://%s.s3.amazonaws.com/' % AWS_STORAGE_BUCKET_NAME
STATIC_URL = S3_URL
KrisF
  • 1,371
  • 13
  • 27
  • We're suffering from the same issue and it is discussed here: http://code.larlet.fr/django-storages/issue/121/s3boto-admin-prefix-issue-with-django-14 I'll probably get around to trying one of the proposed solutions there in the next days. – Alper Mar 05 '13 at 11:41
  • Did you ever find a solution to this problem? I've got the same thing happening and am having luck resolving. – warpedspeed Jul 30 '13 at 21:00

1 Answers1

5

This seems to be fixed in the current development version of django-storages. See issue 121 for more information.

Quick workaround steps:

  1. Replace django-storages in your requirements.txt with -e hg+https://bitbucket.org/david/django-storages@e27c8b61ab57e5afaf21cccfee005c980d89480f#egg=django_storages-dev
  2. In your settings, add AWS_QUERYSTRING_AUTH = False. The result of this setting is that the AWS auth stuff is not included in every URL. Do this only if all files in your S3 bucket are public.
Danilo Bargen
  • 18,626
  • 15
  • 91
  • 127