Reputation: 2019
I am trying to get Boto to format my urls as: //s3.amazonaws.com/BUCKETNAME/FILEPATH/
but it is always returning //BUCKETNAME/s3.amazonaws.com/FILEPATH
instead. I found something about the CallingFormat (http://boto.s3.amazonaws.com/ref/s3.html) but am not sure what to do with it.
I then have:
STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html says you can set a setting AWS_CALLING_FORMAT
to specify what I want but I don't seem to be getting it.
The URLs are generated in the templates with the usual:
{% load staticfiles %}
{% static 'FILEPATH' %}
Upvotes: 3
Views: 1472
Reputation: 14046
Not tested, but based on the source, I think what you want is:
AWS_S3_CALLING_FORMAT = boto.s3.connection.OrdinaryCallingFormat()
(OC you'll need to have import boto.s3.connection
somewhere above)
Note the setting name - it doesn't match what's in the django-storages docs.
The django-storages docs seem to be more oriented towards the plain s3 backend, which is a shame, the boto one is much nicer.
If it's not working, also make sure you're on 1.1.8
- not sure which version started supporting this, but the s3boto backend underwent some big changes at the beginning of the year, this wouldn't work on a 2012 release of django-storages.
Upvotes: 9