tunarob
tunarob

Reputation: 3038

Django and S3 - static URL won't change

I managed to set my S3 as a subdomain static.domain.com (using CNAME and bucket name the same as subdomain).Now I'd like to amend my django settings to use this URL. I use django-storages and can't make it work.

I set STATIC_URL to http://static.domain.com. When I use {{ STATIC_URL }} in my templates - it works. But when I use {% static %} templatetag, or check my static files in the admin panel I see they use: http://static.comain.com.s3.amazonaws.com

I have no idea how to set it properly to make it work. I'd like to make my static (admin + www) to point to the correct URL which is static.domain.com

It's the same situation with media files.

Any clues? Am I missing some settings?

Upvotes: 1

Views: 537

Answers (1)

tunarob
tunarob

Reputation: 3038

I found the solution. All I had to do was to set this in my settings:

import boto.s3.connection

AWS_S3_CALLING_FORMAT = boto.s3.connection.VHostCallingFormat()

Upvotes: 2

Related Questions