4

I am using s3boto, django-pipeline and django-storages with this setting:

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
STATICFILES_STORAGE = 'utils.classutils.S3PipelineStorage'

MEDIA_ROOT = "/"
MEDIA_URL = '//s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME
STATIC_ROOT = '/static/'
STATIC_URL = '//s3.amazonaws.com/%s/static/' % AWS_STORAGE_BUCKET_NAME
STATICFILES_DIRS = (
    os.path.join(SITE_ROOT, 'assets'),
)

and this custom storage for django-pipeline

from django.contrib.staticfiles.storage import CachedFilesMixin
from pipeline.storage import PipelineMixin
from storages.backends.s3boto import S3BotoStorage

class S3PipelineStorage(PipelineMixin, CachedFilesMixin, S3BotoStorage):
    pass

but I keep on getting:

ValueError: The file 'project/head.png' could not be found with <utils.classutils.S3PipelineStorage object at 0x2163510>.

but this file does not exist anywhere! not in plugins, I tried finding it, I checked my static dirs, tried finding it in admin, and I don't even remember working with a file named like this! I tried findstatic and the file can't be found.

What could I be missing?

2 Answers 2

3

You certainly have a css file that point to a non-existing 'project/head.png' file, remove this reference, and it should work.

Sign up to request clarification or add additional context in comments.

1 Comment

the only thing I would add here that in my case png image was referenced from commented part of css(while I thought that pipeline compressors skip them)
1

Short tip. I encountered this when I was setting up S3 for serving static files.

I wanted to serve static content from s3 and keep handling uploaded files to the media folder on the local machine. What I had then was one image that was referenced in a css-file on s3 that was pointing to an image in the media folder like this background: url(../media/some/image.png).

Obviously that file could not be found in s3 with the relative path that was set in the css and the upload crashed. It works locally but not when running staticfiles from s3.

2 Comments

so how did you fix it?
@DmytriyVoloshyn It was just a matter of setting the proper relative path. If the relative path for your local hd and S3 is the same you will never encounter this issue. So, I got the error since the folder hierarchy locally and remotely was different. I adjusted so they were the same and then it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.