django-storage

Access Denied error with Amazon S3

↘锁芯ラ 提交于 2020-01-03 11:46:34
问题 I'm getting an Access Denied error with Amazon S3 and can't figure out why. My settings are as follows: STATIC_URL = 'http://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME What would cause an access denied error? I have verified that my keys are correct. 回答1: The URL you show above would resolve to a bucket within S3. In order to access that bucket successfully with such a URL, the permissions on the bucket would have to grant 'public-read' access to the bucket. In addition, each object or

How to use django-google-cloud-storage for GCS in Django on GAE

时间秒杀一切 提交于 2019-12-25 04:35:21
问题 How do I use a Django Custom Storage backend with Google Cloud Storage? Trying to use this: ckopanos's django-google-cloud-storage As per the documentation I have added the following to my 'settings.py': GOOGLE_CLOUD_STORAGE_BUCKET = [my bucket name] # the name of the bucket you have created from the google cloud storage console GOOGLE_CLOUD_STORAGE_URL = [my bucket URL] #whatever the url for accessing your cloud storgage bucket GOOGLE_CLOUD_STORAGE_DEFAULT_CACHE_CONTROL = [cache control] #

what settings do i need to make django-filebrowser work with s3 storages?

我的未来我决定 提交于 2019-12-24 08:14:03
问题 I feel like I've tried just about everything here in getting static and user uploads folders to work with s3. At this point when I run collectstatic all the folders inside media end up inside static , even though I'm pretty sure I configured things for two folders to be created. I suspect it's something to do with django-filebrowser. It seems that they have made some settings for storages but for the life of me I can't figure out how to make them work: http://django-filebrowser.readthedocs

How to get the aws s3 object key using django-storages and boto3

假装没事ソ 提交于 2019-12-24 03:41:34
问题 I am using django-storage and boto3 for media and static files using aws s3. I need to get the object key of aws s3 bucket, so that I can generate a url for that object. client = boto3.client('s3') bucket_name = 'django-bucket' key = ??? u = client.generate_presigned_url('get_object', Params = {'Bucket': bucket_name, 'Key': key,'ResponseContentType':'image/jpeg', 'ResponseContentDisposition': 'attachment; filename="your-filename.jpeg"'}, ExpiresIn = 1000) These are in my settings: STATICFILES

Collectstatic creates empty files

孤街醉人 提交于 2019-12-23 11:53:06
问题 I'm trying to upgrade an app to Django 1.11, but experience issues with collectstatic . Old versions: django 1.8.17 django-storages 1.5.1 New versions: django 1.11.12 django-storages 1.6.6 Storage: class StaticS3BotoStorage(ManifestFilesMixin, S3BotoStorage): location = 'static' file_overwrite = True preload_metadata = True or class StaticS3BotoStorage(CachedFilesMixin, S3BotoStorage): location = 'static' file_overwrite = True preload_metadata = True With the old versions, collectstatic

Django-Compressor throws UncompressableFileError with django-storages using amazonaws and heroku

让人想犯罪 __ 提交于 2019-12-23 04:14:08
问题 I am having problem to locate the issue of the problem. I have settings folder and inside I have local.py, common.py and production.py. All is working great and it is compressing on localhost, but not on heroku. When I deploy it I am getting error: Internal Server Error: / UncompressableFileError at / 'https://xxxxx.s3.amazonaws.com/static/css/stylesheet.css' isn't accessible via COMPRESS_URL ('//xxxxx.s3.amazonaws.com/static/') and can't be compressed common.py # STATIC FILE CONFIGURATION #

Setting url of Django Imagefield model attribute via custom storage written for Azure Cloud Storage

Deadly 提交于 2019-12-23 02:21:12
问题 I have a Django web app where users upload images and others view them. I have a custom storage class in this app to upload image files to Azure Cloud Storage. Currently images are being uploaded successfully, but their urls are not being set. Thus, the following code in my template yields a broken image: {% if entry.image_file %} <img src="{{ entry.image_file.url }}"></img><br> {% endif %} Can you point out what my custom storage class is missing? Here's how it appears in my models.py

How do you set “Content-Type” when saving to S3 using django-storages with S3boto backend?

情到浓时终转凉″ 提交于 2019-12-22 03:41:50
问题 I am using django-storages with s3boto as a backend. I have one bucket with two folders - one for static and one for media . I achieve this using django-s3-folder-storage . As well as saving to S3 using a model, I also want to implement an image-resize-and-cache function to save the files to S3. To do this I interact directly with my S3 bucket. The code works, but the Content-Type isn't set on S3. in iPython: In [2]: from s3_folder_storage.s3 import DefaultStorage In [3]: s3media =

How do you set “Content-Type” when saving to S3 using django-storages with S3boto backend?

孤街醉人 提交于 2019-12-22 03:41:06
问题 I am using django-storages with s3boto as a backend. I have one bucket with two folders - one for static and one for media . I achieve this using django-s3-folder-storage . As well as saving to S3 using a model, I also want to implement an image-resize-and-cache function to save the files to S3. To do this I interact directly with my S3 bucket. The code works, but the Content-Type isn't set on S3. in iPython: In [2]: from s3_folder_storage.s3 import DefaultStorage In [3]: s3media =

Why does default_storate.exists() with django-storages with S3Boto backend cause a memory error with a large S3 bucket?

雨燕双飞 提交于 2019-12-21 22:54:19
问题 I am experiencing what looks like a memory leak with django-storages using the S3Boto backend, when running default_storage.exists() I'm following the docs here: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html Here is the relevant part of my settings file: DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' Here is what I do to repeat the issue: ./manage.py shell from django.core.files.storage import default_storage # Check default storage is right default