django-storage

default_storage.exists extremely slow and frequently times out

南楼画角 提交于 2019-12-06 13:46:16
We have just migrated a Django project to Heroku and put all of our media and static files on Amazon S3 (using django-storages and s3-boto). Despite everything I've heard about Amazon S3 being very fast, and turning up very few results on slow performance, our image loading has slowed to an absolute crawl and frequently times out. An example of the code that is timing out is this property on one of our models, which tries to select an appropriate image, ultimately falling back to returning None : @property def photo(self): """Transparently serve the best available image for templates""" if

django/whitenoise storage backend causes an error

坚强是说给别人听的谎言 提交于 2019-12-06 10:43:05
问题 i've encountered an 500 error when running my django app on heroku on debug off. after using rollbar to get idea why the error was happaning it reported the following: ValueError: The file 'media/img 1.jpg' could not be found with <whitenoise.storage.CompressedManifestStaticFilesStorage object at 0x7f795706f550>. i figured out it has to do with the STATICFILES_STORAGE setting, by removing it and using the default django STATICFILES_STORAGE ='django.contrib.staticfiles.storage

Serving Django's static and media files from S3

夙愿已清 提交于 2019-12-05 06:54:43
I'm having a weird problem and I have no idea what's causing it. Here's my current config (using Heroku ): MEDIA_URL = '/media/' STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(PROJECT_DIR, '../static'), ) #Determine if local or deployed. if 'DATABASE_URL' in os.environ: STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage' AWS_ACCESS_KEY_ID = 'A...A' AWS_SECRET_ACCESS_KEY = '...R' DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' # PRODUCTION OR STAGING if 'PROD' in os.environ: AWS_STORAGE_BUCKET_NAME = 's3.project.com' STATIC_URL = "https://s3.amazonaws.com

Connection reset by peer when using s3, boto, django-storage for static files

久未见 提交于 2019-12-03 22:20:45
I'm trying to switch to use amazon s3 to host our static files for our django project. I am using django, boto, django-storage and django-compressor. When I run collect static on my dev server, I get the error socket.error: [Errno 104] Connection reset by peer The size of all of my static files is 74MB, which doesnt seem too large. Has anyone seen this before, or have any debugging tips? Here is the full trace. Traceback (most recent call last): File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/_

What permissions does django-storages require for an s3 IAM user?

試著忘記壹切 提交于 2019-12-03 16:48:54
问题 As the question asks, what are the minimum required permissions for a locked down s3 IAM user to use django-storages successfully? At the present time I've used something like { "Statement": [ { "Effect": "Allow", "Action": ["s3:ListAllMyBuckets"], "Resource": "arn:aws:s3:::*" }, { "Effect": "Allow", "Action": ["s3:ListBucket", "s3:GetBucketLocation", "s3:ListBucketMultipartUploads", "s3:ListBucketVersions"], "Resource": "arn:aws:s3:::bucket-name" }, { "Effect": "Allow", "Action": ["s3:

Django storage s3 media url is https:// instead of http://

拜拜、爱过 提交于 2019-12-03 11:59:19
When serving media with django-storage s3, the media url that is being generated is something like this: https://mybucket.s3.amazonaws.com/myimage.jpg?Signature=5ifoyLqzmtfVNS1ovfzVvN92RH0%3D&Expires=1363124819&AWSAccessKeyId=AKIAJ7ZTU7K4SPYKGOFA Causing the images to not be displayed because of https: You attempted to reach mybucket.s3.amazonaws.com, but instead you actually reached a server identifying itself as *.s3.amazonaws.com. This may be caused by a misconfiguration on the server or by something more serious. An attacker on your network could be trying to get you to visit a fake (and

Error “Could not load Boto's S3 bindings.”

若如初见. 提交于 2019-12-03 10:08:28
I have followed the very terse guide provided for django-storages , transitioned from local file storage, and have come up against this exception: Could not load Boto's S3 bindings. settings.py DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' AWS_ACCESS_KEY_ID = "xxxxxx" AWS_SECRET_ACCESS_KEY = "xxxxxxxxx" AWS_STORAGE_BUCKET_NAME = "images" models.py class CameraImage(models.Model): ... image = models.ImageField(upload_to='images')#get_image_path) What does that exception mean? How do I fix it? From looking at the source code , it appears you need to have the python-boto library

Django collectstatic from Heroku pushes to S3 everytime

我只是一个虾纸丫 提交于 2019-12-03 06:15:19
问题 I'm using django-storages for static files with S3 (and S3BotoStorage). When I do collectstatic from my local machine, the behaviour is as expected, where only modified files are pushed to S3. This process needs python-dateutils 1.5 to check for modified time. However, doing the same on Heroku results in every file being pushed regardless, although the setup is the same. I then looked into the modified time of the files on Heroku itself, and it seems like, the os.stat(static_filename).st

Storing images and thumbnails on s3 in django

跟風遠走 提交于 2019-12-03 01:31:06
问题 I'm trying to get my images thumbnailed and stored on s3 using django-storages, boto, and sorl-thumbnail. I have it working, but it's very slow, even with small images. I don't mind it being slow when I save the form and upload the images to s3, but I'd like it to display the image quickly after that. The answer to this SO question explains that the thumbnail won't be created until first access, but that you can use get_thumbnail() to create it beforehand. Django + S3 (boto) + Sorl Thumbnail:

Django collectstatic from Heroku pushes to S3 everytime

你说的曾经没有我的故事 提交于 2019-12-02 20:50:27
I'm using django-storages for static files with S3 (and S3BotoStorage). When I do collectstatic from my local machine, the behaviour is as expected, where only modified files are pushed to S3. This process needs python-dateutils 1.5 to check for modified time. However, doing the same on Heroku results in every file being pushed regardless, although the setup is the same. I then looked into the modified time of the files on Heroku itself, and it seems like, the os.stat(static_filename).st_mtime is the same as the time of the last push. Is this expected behaviour? Does heroku copy around files