Django app on heroku - trying to use amazon s3 for static files but
getting 404 errors
I've set everything up and gotten collectstatic to put my files in my
bucket on S3...but when I go to my site I get 404 errors for my static
files. I'm on heroku and am not sure how to go about fixing whatever is
wrong...maybe the path to my static files? I've done a lot of googling and
afraid that I've put too many partial tutorials together and am not too
sure of what I'm doing in general.
Settings.py
import os
import boto
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = "static"
AWS_STORAGE_BUCKET_NAME = os.environ['AWS_STORAGE_BUCKET_NAME']
STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
S3_URL = 'http://' + AWS_STORAGE_BUCKET_NAME + '.s3.amazonaws.com/'
STATIC_URL = S3_URL
ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
I have the environmental variables for my AWS bucket and keys stored in
heroku config...let me know if more information is needed. I've been able
to put the files in my bucket, but now am getting the 404 errors. I tried
creating a 'static' folder in my bucket and moving a couple of files into
it but still got the 404 errors. What am I doing wrong?
Example of error:
2013-08-14T21:00:11.581989+00:00 heroku[router]: at=info method=GET
path=/static/48x48-Circle-84-FB.png host=<myApp>.herokuapp.com
fwd="74.72.99.26" dyno=web.1 connect=12ms service=12ms status=404
bytes=2500
No comments:
Post a Comment